SecuredRedirectHandler enforces that all requests passing through it must have Request#isSecure() set to true.
SecuredRedirectHandler will send a Redirect HTTP Response (default to 302: Moved Temporarily)
with the information present in the HttpConfiguration for the connector that the response is being processed on.
The Location response header will be built from HttpConfiguration#getSecureScheme() and
HttpConfiguration#getSecurePort()
| Modifier and Type | Field and Description |
|---|---|
| private final int | _redirectCode
The redirect code to send in response. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SecuredRedirectHandler(int
the redirect code to use in the response code)Use supplied code as the redirect code. |
| public | |
| public | SecuredRedirectHandler(Handler
the handler to wrap handler, int the redirect code to use in the response code)Use supplied code as the redirect code. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | handle(Request
the HTTP request to handle request, Response the HTTP response to handle response, Callback the callback to complete when the handling is complete callback)Overrides org. Implements org. Invoked to handle the passed HTTP request and response. |
| _redirectCode | back to summary |
|---|---|
| private final int _redirectCode The redirect code to send in response. | |
| SecuredRedirectHandler | back to summary |
|---|---|
| public SecuredRedirectHandler() Uses moved temporarily code (302) as the redirect code. | |
| SecuredRedirectHandler | back to summary |
|---|---|
| public SecuredRedirectHandler(int code) Use supplied code as the redirect code.
| |
| SecuredRedirectHandler | back to summary |
|---|---|
| public SecuredRedirectHandler(Handler handler) Uses moved temporarily code (302) as the redirect code. | |
| SecuredRedirectHandler | back to summary |
|---|---|
| public SecuredRedirectHandler(Handler handler, int code) Use supplied code as the redirect code.
| |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception Overrides org. Implements org. Doc from org. Invoked to handle the passed HTTP request and response. The request is accepted by returning true, then handling must be concluded by completing the passed callback. The handling may be asynchronous, i.e. this method may return true and complete the given callback later, possibly from a different thread. If this method returns false, then the callback must not be invoked and any mutation on the response reversed. Exceptions thrown by this method may be subsequently handled by an error The simplest implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
}
A HelloWorld implementation is:
public boolean handle(Request request, Response response, Callback callback)
{
response.write(true, ByteBuffer.wrap("Hello World\n".getBytes(StandardCharsets.UTF_8)), callback);
return true;
}
| |