100 HttpResponse() : m_nStatusCode(200), m_sContentType(
"text/plain"), m_bHeadersSent(false), m_bChunked(false) {}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Defines HTTP status codes defined for HTTP/1.1 and HTTP/2.
Provides the underlying stream of data for network access.
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents a collection of keys and values.
Supports all classes in the DotNetDupe class hierarchy.
A unified smart pointer that supports both unique and shared ownership semantics.
static SmartPointer< T > NewShared()
Creates a Shared SmartPointer, default constructing T.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
DotNetDupe::System::SmartPointer< HttpRequest > GetRequest() const
Gets the HttpRequest representation for this execution context.
~HttpContext() override=default
Virtual destructor.
HttpContext()
Default constructor instantiating paired HttpRequest and HttpResponse objects.
DotNetDupe::System::SmartPointer< HttpResponse > GetResponse() const
Gets the HttpResponse representation for this execution context.
void SetPath(const DotNetDupe::System::String &path)
Sets the request URI path.
DotNetDupe::System::String GetBody() const
Gets the raw HTTP request body string.
DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetRouteValues()
Gets the mutable dictionary of matched route parameter values.
const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetQuery() const
Gets the read-only dictionary of decoded URL query parameters.
DotNetDupe::System::String GetMethod() const
Gets the HTTP request method verb (e.g., "GET", "POST").
void SetMethod(const DotNetDupe::System::String &method)
Sets the HTTP request method verb.
DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetQuery()
Gets the mutable dictionary of decoded URL query parameters.
const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetRouteValues() const
Gets the read-only dictionary of matched route parameter values.
DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetHeaders()
Gets the mutable dictionary of HTTP request headers.
HttpRequest()=default
Default constructor.
const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetHeaders() const
Gets the read-only dictionary of HTTP request headers.
DotNetDupe::System::String GetPath() const
Gets the request URI path.
~HttpRequest() override=default
Virtual destructor.
void SetBody(const DotNetDupe::System::String &body)
Sets the raw HTTP request body string.
void SetStatusCode(int code)
Sets the integer HTTP response status code.
void BindStream(DotNetDupe::System::SmartPointer< DotNetDupe::System::Net::Sockets::NetworkStream > pStream)
Binds the underlying network stream to this response for direct writing or streaming.
HttpResponse()
Default constructor initializing status code 200 OK and text/plain content type.
void SetStatusCode(DotNetDupe::System::Net::HttpStatusCode code)
Sets the HTTP response status code via HttpStatusCode enum.
void Write(const DotNetDupe::System::String &text)
Appends text to the response body buffer.
DotNetDupe::System::String GetContentType() const
Gets the Content-Type header string.
void SetChunked(bool bChunked)
Sets whether chunked transfer-encoding should be used.
int GetStatusCode() const
Gets the integer HTTP response status code.
void SetContentType(const DotNetDupe::System::String &type)
Sets the Content-Type header string.
void FlushHeaders()
Serializes and transmits the HTTP status line and response headers to the network stream.
DotNetDupe::System::String GetBody() const
Gets the accumulated response body string.
bool IsHeadersSent() const
Indicates whether the HTTP response status line and headers have already been transmitted.
const DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetHeaders() const
Gets the read-only dictionary of HTTP response headers.
DotNetDupe::System::Collections::Generic::Dictionary< DotNetDupe::System::String, DotNetDupe::System::String > & GetHeaders()
Gets the mutable dictionary of HTTP response headers.
void SetBody(const DotNetDupe::System::String &body)
Sets the response body content.
bool IsChunked() const
Indicates whether chunked transfer-encoding is enabled for this response.
void WriteChunk(const DotNetDupe::System::String &data)
Writes a chunk of data using HTTP/1.1 chunked transfer encoding.
~HttpResponse() override=default
Virtual destructor.
void Flush()
Flushes any remaining response body or terminal chunk marker to the client stream.
DotNetDupe::System::Net::HttpStatusCode GetStatusCodeEnum() const
Gets the HTTP response status code as a strongly-typed HttpStatusCode enum.
HttpStatusCode
Contains the values of status codes defined for HTTP in RFC 9110 and RFC 7231.