The representation of an HTTP response, for any protocol version (HTTP/1.1, HTTP/2, HTTP/3).
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Method and Description |
|---|---|
| public static void | addCookie(Response
the HTTP response response, HttpCookie the HTTP cookie to add cookie)Adds an HTTP |
| public static < the response type T> T | |
| public static OutputStream | Returns: a bufferingOutputStreamthe request from which to get the buffering sink's settings request, Response the response to wrap response)Wraps a |
| public static Content. | Returns: a bufferingContent.the request from which to get the buffering sink's settings request, Response the response to wrap response)Wraps a |
| public static long | Returns: the number of response content bytes written to the network so far, or-1 if the number is unknownthe HTTP response response)
|
| public HttpFields. | |
| public static Response | Returns: the innermost wrapped response instancethe response to unwrap response)Unwraps the given response until the innermost wrapped response instance. |
| public Request | |
| public int | |
| public Supplier | |
| public boolean | |
| public boolean | Returns: whether this response has already been committedReturns whether this response has already been committed. |
| public boolean | Returns: whether the response completed successfullyReturns whether the response completed successfully. |
| public static Content. | Returns: A chunk processor that will add trailer chunks to the response's trailer supplied fields.The response for which to process a trailers chunk.
If the response)Response#setTrailersSupplier(Supplier)
method has not been called prior to this method, then a noop processor is returned.Returns a chunk processor suitable to be passed to the
|
| public static void | putCookie(Response
the HTTP response response, HttpCookie the HTTP cookie to add cookie)Put a HTTP |
| public static void | replaceCookie(Response
the HTTP response response, HttpCookie the HTTP cookie to add cookie)
Deprecated
use
Replace a cookie
putCookie(Response, HttpCookie)
|
| public void | |
| public static void | sendRedirect(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, String the redirect location as an absolute URI or encoded relative URI path. location)Sends a HTTP redirect status code to the given location, without consuming the available request content. |
| public static void | sendRedirect(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, String the redirect location as an absolute URI or encoded relative URI path. location, boolean whether to consumer the available request content consumeAvailable)Sends HTTP redirect status code to the given location, without consuming the available request content. |
| public static void | sendRedirect(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, int the redirect HTTP status code code, String the redirect location as an absolute URI or encoded relative URI path. location, boolean whether to consumer the available request content consumeAvailable)Sends a |
| public void | |
| public void | setTrailersSupplier(Supplier<HttpFields>
a supplier for the HTTP trailers trailers)Sets the supplier for the HTTP trailers. |
| public static String | Returns: the full redirect "Location" URL (including scheme, host, port, path, etc...)the request the redirect should be based on (needed when relative locations are provided, so that
server name, scheme, port can be built out properly) request, String the redirect location as an absolute URI or encoded relative URI path. If a relative path starts
with '/', then it is relative to the root, otherwise it is relative to the request. location)Common point to generate a proper "Location" header for redirects. |
| public void | write(boolean
whether the ByteBuffer is the last to write last, ByteBuffer the ByteBuffer to write byteBuffer, Callback the callback to notify when the write operation is complete callback)Redeclares org. Writes the given |
| public static void | writeError(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, Throwable the cause of the error cause)Writes an error response with HTTP status code |
| public static void | writeError(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, int the error HTTP status code status)Writes an error response with the given HTTP status code. |
| public static void | writeError(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, int the error HTTP status code status, String the error message to write in the response content message)Writes an error response with the given HTTP status code, and the given message in the response content. |
| public static void | writeError(Request
the HTTP request request, Response the HTTP response response, Callback the callback to complete callback, int the error HTTP status code status, String the error message to write in the response content message, Throwable the cause of the error cause)Writes an error response with the given HTTP status code, and the given message in the response content. |
| public CompletableFuture | Returns: aCompletableFuture with the result of the writethe interim HTTP status code status, HttpFields the HTTP headers headers)Writes an |
| addCookie | back to summary |
|---|---|
| public static void addCookie(Response response, HttpCookie cookie) Adds an HTTP
| |
| as | back to summary |
|---|---|
| public static <T> T as(Response response, Class<T> type) Unwraps the given response, recursively, until the wrapped instance
is an instance of the given type, otherwise returns
| |
| asBufferedOutputStream | back to summary |
|---|---|
| public static OutputStream asBufferedOutputStream(Request request, Response response) Wraps a This is equivalent to:
| |
| asBufferedSink | back to summary |
|---|---|
| public static Content. Wraps a
| |
| getContentBytesWritten | back to summary |
|---|---|
public static long getContentBytesWritten(Response response)
| |
| getHeaders | back to summary |
|---|---|
public HttpFields.
| |
| getOriginalResponse | back to summary |
|---|---|
| public static Response getOriginalResponse(Response response) Unwraps the given response until the innermost wrapped response instance. | |
| getRequest | back to summary |
|---|---|
| public Request getRequest() | |
| getStatus | back to summary |
|---|---|
public int getStatus()
| |
| getTrailersSupplier | back to summary |
|---|---|
public Supplier
| |
| hasLastWrite | back to summary |
|---|---|
| public boolean hasLastWrite() Returns whether the last write has been initiated on the response.
| |
| isCommitted | back to summary |
|---|---|
| public boolean isCommitted() Returns whether this response has already been committed. Committing a response means that the HTTP status code and HTTP headers cannot be modified anymore, typically because they have already been serialized and sent over the network.
| |
| isCompletedSuccessfully | back to summary |
|---|---|
| public boolean isCompletedSuccessfully() Returns whether the response completed successfully. The response HTTP status code, HTTP headers and content have been successfully serialized and sent over the network without errors.
| |
| newTrailersChunkProcessor | back to summary |
|---|---|
| public static Content. Returns a chunk processor suitable to be passed to the
This is specifically useful for writing trailers that have been received via
the Content.copy(request, response, Response.asTrailerChunkHandler(response), callback);
| |
| putCookie | back to summary |
|---|---|
| public static void putCookie(Response response, HttpCookie cookie) Put a HTTP If a matching
| |
| replaceCookie | back to summary |
|---|---|
| public static void replaceCookie(Response response, HttpCookie cookie)
Deprecated Replace a cookie
| |
| reset | back to summary |
|---|---|
| public void reset() Resets this response, clearing the HTTP status code, HTTP headers and HTTP trailers.
| |
| sendRedirect | back to summary |
|---|---|
| public static void sendRedirect(Request request, Response response, Callback callback, String location) Sends a HTTP redirect status code to the given location,
without consuming the available request content. The
| |
| sendRedirect | back to summary |
|---|---|
| public static void sendRedirect(Request request, Response response, Callback callback, String location, boolean consumeAvailable) Sends HTTP redirect status code to the given location,
without consuming the available request content. The
| |
| sendRedirect | back to summary |
|---|---|
| public static void sendRedirect(Request request, Response response, Callback callback, int code, String location, boolean consumeAvailable) Sends a
| |
| setStatus | back to summary |
|---|---|
| public void setStatus(int code) Set the response HTTP status code.
| |
| setTrailersSupplier | back to summary |
|---|---|
| public void setTrailersSupplier(Supplier<HttpFields> trailers) Sets the supplier for the HTTP trailers. The method Example:
| |
| toRedirectURI | back to summary |
|---|---|
| public static String toRedirectURI(Request request, String location) Common point to generate a proper "Location" header for redirects.
| |
| write | back to summary |
|---|---|
| public void write(boolean last, ByteBuffer byteBuffer, Callback callback) Redeclares org. Doc from org. Writes the given Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the The invocation of the passed Thus a
| |
| writeError | back to summary |
|---|---|
| public static void writeError(Request request, Response response, Callback callback, Throwable cause) Writes an error response with HTTP status code The error | |
| writeError | back to summary |
|---|---|
| public static void writeError(Request request, Response response, Callback callback, int status) Writes an error response with the given HTTP status code. The error | |
| writeError | back to summary |
|---|---|
| public static void writeError(Request request, Response response, Callback callback, int status, String message) Writes an error response with the given HTTP status code, and the given message in the response content. The error | |
| writeError | back to summary |
|---|---|
| public static void writeError(Request request, Response response, Callback callback, int status, String message, Throwable cause) Writes an error response with the given HTTP status code, and the given message in the response content. The error | |
| writeInterim | back to summary |
|---|---|
| public CompletableFuture Writes an It is possible to write more than one interim response, for example
in case of The returned
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public HttpFields. | |
| public Request | |
| public int | |
| public Supplier | |
| public Response | |
| public boolean | hasLastWrite()
Implements org. Returns whether the last write has been initiated on the response. |
| public boolean | isCommitted()
Implements org. Returns whether this response has already been committed. |
| public boolean | isCompletedSuccessfully()
Implements org. Returns whether the response completed successfully. |
| public void | reset()
Implements org. Resets this response, clearing the HTTP status code, HTTP headers and HTTP trailers. |
| public void | setStatus(int
the response HTTP status code code)Implements org. |
| public void | setTrailersSupplier(Supplier<HttpFields>
a supplier for the HTTP trailers trailers)Implements org. Sets the supplier for the HTTP trailers. |
| public void | write(boolean
whether the ByteBuffer is the last to write last, ByteBuffer the ByteBuffer to write byteBuffer, Callback the callback to notify when the write operation is complete callback)Implements org. Writes the given |
| public CompletableFuture | writeInterim(int
the interim HTTP status code status, HttpFields the HTTP headers headers)Implements org. Writes an |
| _request | back to summary |
|---|---|
| private final Request _request | |
| _wrapped | back to summary |
|---|---|
| private final Response _wrapped | |
| Wrapper | back to summary |
|---|---|
| public Wrapper(Request request, Response wrapped) | |
| getHeaders | back to summary |
|---|---|
| public HttpFields. Implements org.
| |
| getRequest | back to summary |
|---|---|
| public Request getRequest() Implements org.
| |
| getStatus | back to summary |
|---|---|
| public int getStatus() Implements org.
| |
| getTrailersSupplier | back to summary |
|---|---|
| public Supplier Implements org.
| |
| getWrapped | back to summary |
|---|---|
| public Response getWrapped() | |
| hasLastWrite | back to summary |
|---|---|
| public boolean hasLastWrite() Implements org. Doc from org. Returns whether the last write has been initiated on the response.
| |
| isCommitted | back to summary |
|---|---|
| public boolean isCommitted() Implements org. Doc from org. Returns whether this response has already been committed. Committing a response means that the HTTP status code and HTTP headers cannot be modified anymore, typically because they have already been serialized and sent over the network.
| |
| isCompletedSuccessfully | back to summary |
|---|---|
| public boolean isCompletedSuccessfully() Implements org. Doc from org. Returns whether the response completed successfully. The response HTTP status code, HTTP headers and content have been successfully serialized and sent over the network without errors.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Doc from org. Resets this response, clearing the HTTP status code, HTTP headers and HTTP trailers.
| |
| setStatus | back to summary |
|---|---|
| public void setStatus(int code) Implements org. Doc from org. Set the response HTTP status code.
| |
| setTrailersSupplier | back to summary |
|---|---|
| public void setTrailersSupplier(Supplier<HttpFields> trailers) Implements org. Doc from org. Sets the supplier for the HTTP trailers. The method Example:
| |
| write | back to summary |
|---|---|
| public void write(boolean last, ByteBuffer byteBuffer, Callback callback) Implements org. Doc from org. Writes the given Implementations guarantee that calls to this method are safely reentrant so that
stack overflows are avoided in the case of mutual recursion between the execution of
the The invocation of the passed Thus a
| |
| writeInterim | back to summary |
|---|---|
| public CompletableFuture Implements org. Doc from org. Writes an It is possible to write more than one interim response, for example
in case of The returned
| |