Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Servers.HttpResponseContent

Summary

Encapsulates an HTTP response, to be sent by HttpServer to the HTTP client that sent the original request. A request handler must return an HttpResponse object to the HttpServer when handling a request.

Constructors

HttpResponseContent(HttpStatusCode status, HttpResponseHeaders headers, Func<Stream> contentStreamDelegate = null)
Initializes an HTTP response.

Static methods

HttpResponseContent
Create(string content, string contentType, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the specified content to the client with the specified MIME type.
HttpResponseContent
Create(byte[] content, string contentType, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified byte array to the client with the specified MIME type.
HttpResponseContent
Create(Stream content, string contentType, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified stream to the client with the specified MIME type.
HttpResponseContent
Create(IEnumerable<string> content, string contentType, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified content to the client as a single concatenated piece of text with the specified MIME type.
HttpResponseContent
Css(string content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the specified content to the client with the MIME type “text/css; charset=utf-8”.
HttpResponseContent
Css(byte[] content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified byte array to the client.
HttpResponseContent
Css(Stream content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified stream to the client.
HttpResponseContent
Css(IEnumerable<string> content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified content to the client as a single concatenated piece of text with the MIME type “text/css; charset=utf-8”.
HttpResponseContent Returns a response to the client consisting of an empty body.
HttpResponseContent
File(string filePath, string contentType = null, int? maxAge = 3600, DateTime? ifModifiedSince = null)
Returns the specified file from the local file system using the specified MIME content type to the client.
HttpResponseContent
Html(string content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the specified content to the client with the MIME type “text/html; charset=utf-8”.
HttpResponseContent
Html(byte[] content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified byte array to the client.
HttpResponseContent
Html(Stream content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified stream to the client.
HttpResponseContent
Html(Tag content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified tag content to the client.
HttpResponseContent
Html(IEnumerable<string> content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified content to the client as a single concatenated piece of text with the MIME type “text/html; charset=utf-8”.
HttpResponseContent
JavaScript(string content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the specified content to the client with the MIME type “text/javascript; charset=utf-8”.
HttpResponseContent
JavaScript(byte[] content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified byte array to the client.
HttpResponseContent
JavaScript(Stream content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified stream to the client.
HttpResponseContent
JavaScript(IEnumerable<string> content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified content to the client as a single concatenated piece of text with the MIME type “text/javascript; charset=utf-8”.
HttpResponseContent Returns the specified content to the client with the MIME type “application/json; charset=utf-8”.
HttpResponseContentGenerates a 304 Not Modified response.
HttpResponseContent
PlainText(string content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the specified content to the client with the MIME type “text/plain; charset=utf-8”.
HttpResponseContent
PlainText(byte[] content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified byte array to the client.
HttpResponseContent
PlainText(Stream content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null)
Returns the contents of the specified stream to the client.
HttpResponseContent
PlainText(IEnumerable<string> content, HttpStatusCode status = HttpStatusCode._200_OK, HttpResponseHeaders headers = null, bool buffered = true)
Returns the specified content to the client as a single concatenated piece of text with the MIME type “text/plain; charset=utf-8”.
HttpResponseContent
Redirect(string newUrl)
Redirects the client to a new URL, using the HTTP status code 302 Found and making the response uncacheable.
HttpResponseContent
HttpResponseWebSocket
WebSocket(WebSocket websocket, string subprotocol = null, HttpResponseHeaders headers = null)
Returns an HttpResponseWebSocket which indicates to the client that the HTTP connection should switch to the WebSocket protocol.

Instance methods

StreamRetrieves the stream object containing the response body.
HttpResponseContent Modifies the HttpResponseContent.UseGzip option in this response object and returns the same object.

Operators

HttpResponse Provides an implicit conversion from WebSocket to HttpResponse by assuming no subprotocol and no extra HTTP response headers.

Instance properties

HttpResponseHeadersThe HTTP response headers which are to be sent back to the HTTP client as part of this HTTP response.
HttpStatusCodeThe HTTP status code. For example, 200 OK, 404 Not Found, 500 Internal Server Error. Default is 200 OK.

Instance fields

UseGzipOptionSpecifies whether gzip should be used.