public interface HandlingResult
RequestFixture| Modifier and Type | Method and Description |
|---|---|
<T extends java.lang.Throwable> |
exception(java.lang.Class<T> type)
The throwable thrown or given to
Context.error(Throwable), unless a custom error handler is in use. |
byte[] |
getBodyBytes()
The response body, as bytes.
|
java.lang.String |
getBodyText()
The response body, interpreted as a utf8 string.
|
java.lang.Integer |
getClientError()
The client error raised if any, unless a custom client error handler is in use.
|
java.util.Set<io.netty.handler.codec.http.cookie.Cookie> |
getCookies()
The cookies to be set as part of the response.
|
Headers |
getHeaders()
The final response headers.
|
Registry |
getRegistry()
The final state of the context registry.
|
Registry |
getRequestRegistry()
The final state of the request registry.
|
java.nio.file.Path |
getSentFile()
Indicates whether the result of invoking the handler was that it invoked one of the
Response.sendFile(java.nio.file.Path) methods. |
Status |
getStatus()
The response status information.
|
boolean |
isCalledNext()
Indicates whether the result of invoking the handler was that it delegated to a downstream handler.
|
boolean |
isSentResponse()
Indicates the the handler(s) invoked one of the
Response.send() methods. |
<T> T |
rendered(java.lang.Class<T> type)
The object that was rendered to the response.
|
@Nullable byte[] getBodyBytes()
This does not include file or rendered responses.
See getSentFile() and rendered(Class).
null if no response was sent.@Nullable java.lang.String getBodyText()
This does not include file or rendered responses.
See getSentFile() and rendered(Class).
null if no response was sent.@Nullable java.util.Set<io.netty.handler.codec.http.cookie.Cookie> getCookies()
Cookies are set during request processing via the Response.cookie(String, String) method,
or via directly modifying Response.getCookies().
@Nullable java.lang.Integer getClientError()
If no client error was “raised”, will be null.
If a custom client error handler is used (either by specification in the request fixture or insertion by an upstream handler), this will always be null.
In such a case, this result effectively indicates what the custom client error handler did as its implementation.
null.<T extends java.lang.Throwable> T exception(java.lang.Class<T> type)
Context.error(Throwable), unless a custom error handler is in use.
If no throwable was “raised”, a new HandlerExceptionNotThrownException is raised.
If a custom error handler is used (either by specification in the request fixture or insertion by an upstream handler),
this will always raise a new HandlerExceptionNotThrownException
In such a case, this result effectively indicates what the custom error handler did as its implementation.
T - The expected type of the exception captured.type - The expected type of the exception captured.HandlerExceptionNotThrownExceptionHeaders getHeaders()
Registry getRegistry()
Registry getRequestRegistry()
@Nullable java.nio.file.Path getSentFile()
Response.sendFile(java.nio.file.Path) methods.
This does not include files rendered with Context.render(Object).
Response.sendFile(java.nio.file.Path) methods, or null if none of these methods were calledStatus getStatus()
Indicates the state of the context's Response.getStatus() after invoking the handler.
If the result is a sent response, this indicates the status of the response.
boolean isCalledNext()
boolean isSentResponse()
Response.send() methods.Response.send() methods was invoked@Nullable <T> T rendered(java.lang.Class<T> type) throws java.lang.AssertionError
The exact object that was given to Context.render(Object).
The value must be assignment compatible with given type token.
If it is not, an AssertionError will be thrown.
T - the expect type of the rendered objecttype - the expect type of the rendered objectnull if no object was renderedjava.lang.AssertionError - if the rendered object cannot be cast to the given type