A ContextHandler with a child Handler
that redirects to a configurable URI.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private HttpField | |
| private boolean | |
| private boolean | |
| private String | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: theCache-Control header value or nullGet the |
| public String | |
| public int | Returns: the redirect status code, by default 303Get the redirect status code, by default 303. |
| public boolean | |
| public boolean | |
| public void | setCacheControl(String
the cacheControl)Cache-Control header value or nullSet the |
| public void | setDiscardPathInContext(boolean
whether the original request discardPathInContext)pathInContext is discardedWhether to discard the original request |
| public void | setDiscardQuery(boolean
whether the original request query is discarded discardQuery)Whether to discard the original request query when building the redirect URI. |
| public void | |
| public void |
| _cacheControl | back to summary |
|---|---|
| private HttpField _cacheControl | |
| _discardPathInContext | back to summary |
|---|---|
| private boolean _discardPathInContext | |
| _discardQuery | back to summary |
|---|---|
| private boolean _discardQuery | |
| _redirectURI | back to summary |
|---|---|
| private String _redirectURI | |
| _statusCode | back to summary |
|---|---|
| private int _statusCode | |
| MovedContextHandler | back to summary |
|---|---|
| public MovedContextHandler() | |
| getCacheControl | back to summary |
|---|---|
| public String getCacheControl() Get the
| |
| getRedirectURI | back to summary |
|---|---|
| public String getRedirectURI() Get the URI to redirect to.
| |
| getStatusCode | back to summary |
|---|---|
| public int getStatusCode() Get the redirect status code, by default 303.
| |
| isDiscardPathInContext | back to summary |
|---|---|
public boolean isDiscardPathInContext()
| |
| isDiscardQuery | back to summary |
|---|---|
public boolean isDiscardQuery()
| |
| setCacheControl | back to summary |
|---|---|
| public void setCacheControl(String cacheControl) Set the
| |
| setDiscardPathInContext | back to summary |
|---|---|
| public void setDiscardPathInContext(boolean discardPathInContext) Whether to discard the original request
| |
| setDiscardQuery | back to summary |
|---|---|
| public void setDiscardQuery(boolean discardQuery) Whether to discard the original request query when building the redirect URI.
| |
| setRedirectURI | back to summary |
|---|---|
| public void setRedirectURI(String redirectURI) Sets the URI to redirect to. If the redirect URI is not absolute, the original request scheme and authority will be used to build the redirect URI. The original request The original request query will be preserved in the redirect URI, unless
| |
| setStatusCode | back to summary |
|---|---|
public void setStatusCode(int statusCode)
| |
| Access | Constructor and Description |
|---|---|
| private |
| 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)Implements org. Invoked to handle the passed HTTP request and response. |
| Redirector | back to summary |
|---|---|
| private Redirector() | |
| handle | back to summary |
|---|---|
| public boolean handle(Request request, Response response, Callback callback) throws Exception 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;
}
| |