Event associated with this response
Content type as MIME code.
Content type as MIME code. e.g. image/gif
. None
if not set
Sets the content type header for this HTTP response
Sets the content type header for this HTTP response
MIME type. e.g. image/gif
.
Event associated with this response
Headers
Redirects the browser to the specified URL using the 302 HTTP status code.
Redirects the browser to the specified URL using the 302 HTTP status code.
Request
GET /index.html HTTP/1.1
Host: www.example.com
Response
HTTP/1.1 302 Found Location: http://www.newurl.org/
Redirection is NOT buffered. The response is immediately sent to the client.
Calling redirect()
more than once results in an exception being thrown because only 1 response is
permitted per request.
URL to which the browser will be redirected
HTTP Response Status
Aggregate number of bytes sent the client as chunks
Sends a binary HTTP response to the client
Sends a binary HTTP response to the client
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
HTTP Status
Binary data to send in the response body
MIME content type to set in the response header. For example, "image/gif"
Headers to add to the HTTP response. It will be added to the headers
map.
Sends a HTTP response to the client with the status as well as a text message.
Sends a HTTP response to the client with the status as well as a text message. This is typically used for in the event of an error.
HTTP Status
String to send in the response body. The MIME type will be set to text/plain; charset=UTF-8
.
If null or empty string, no content will be sent to the client.
Sends a HTTP response to the client with the status and optional headers.
Sends a HTTP response to the client with the status and optional headers.
Example use could be sending a 201 with status header.
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
HTTP Status
Headers to add to the HTTP response. It will be added to the headers
map.
Sends a HTTP response to the client with just the status and not content.
Sends a HTTP response to the client with just the status and not content. This is typically used for an error.
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
HTTP Status
Sends a binary HTTP response to the client
Sends a binary HTTP response to the client
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
Binary data to send in the response body.
MIME content type
Headers to add to the HTTP response. It will be added to the headers
map.
Sends a binary HTTP response to the client
Sends a binary HTTP response to the client
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
Binary data to send in the response body.
MIME content type
Sends a string HTTP response to the client
Sends a string HTTP response to the client
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
String to send in the response body
MIME content type. If the charset
is not set, UTF-8
is assumed
Headers to add to the HTTP response.
Sends a string HTTP response to the client
Sends a string HTTP response to the client
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
String to send in the response body
MIME content type. If the charset
is not set, UTF-8
is assumed
Sends a string HTTP response to the client
Sends a string HTTP response to the client
The content type will default to text/plain; charset=UTF-8
if not already set in the headers.
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
String to send in the response body
Sends a binary HTTP response to the client.
Sends a binary HTTP response to the client.
This write is NOT buffered. The response is immediately sent to the client.
Calling write()
more than once results in an exception being thrown because only 1 response is permitted per
request.
Bytes to send
Sends a 100 continue to the client
Sends a chunk of data to the client.
Sends a chunk of data to the client.
This method must be called AFTER writeFirstChunk()
.
Writing the a chunk is NOT buffered. The chunk is immediately sent to the client.
Initiates a HTTP chunk response to the client
Initiates a HTTP chunk response to the client
Use this method to initiate the response. Call writeChunk()
to send the individual chunks and finish by
calling writeLastChunk()
.
Writing the first chunk is NOT buffered. The chunk is immediately sent to the client.
Calling writeFirstChunk()
more than once results in an exception being thrown because only 1 response is
permitted per request.
HTTP response status
MIME content type to set in the response header. For example, "image/gif". If omitted, the
content type set in headers
will be used.
Headers to add to the HTTP response.
Initiates a HTTP chunk response to the client
Initiates a HTTP chunk response to the client
Use this method to initiate the response. Call writeChunk()
to send the individual chunks and finish by
calling writeLastChunk()
.
Writing the first chunk is NOT buffered. The chunk is immediately sent to the client.
Calling writeFirstChunk()
more than once results in an exception being thrown because only 1 response is
permitted per request.
MIME content type to set in the response header. For example, "image/gif". If omitted, the
content type set in headers
will be used.
Headers to add to the HTTP response.
Sends a chunk to the client.
Sends a chunk to the client.
This method must be called AFTER the last writeChunk()
.
Writing the last chunk is NOT buffered. The last chunk is immediately sent to the client.
Calling writeLastChunk()
more than once will result in an exception being throw.
Trailing headers
Encapsulates all the data to be sent to the client in an HTTP response; i.e. headers and content.
Event associated with this response