public class FilterContext<T> extends Object
FilterContext
can be used to decorate Request
and AsyncHandler
from a list of RequestFilter
.
RequestFilter
gets executed before the HTTP request is made to the remote server. Once the response bytes are
received, a FilterContext
is then passed to the list of ResponseFilter
. ResponseFilter
gets invoked before the response gets processed, e.g. before authorization, redirection and invokation of AsyncHandler
gets processed.
Invoking getResponseStatus()
returns an instance of HttpResponseStatus
that can be used to decide if the response processing should continue or not. You can stop the current response processing
and replay the request but creating a FilterContext
. The AsyncHttpProvider
will interrupt the processing and "replay" the associated Request
instance.Modifier and Type | Class and Description |
---|---|
static class |
FilterContext.FilterContextBuilder<T> |
Constructor and Description |
---|
FilterContext(AsyncHandler<T> asyncHandler,
Request request)
Deprecated.
use
FilterContext.FilterContextBuilder instead |
FilterContext(AsyncHandler<T> asyncHandler,
Request request,
boolean replayRequest)
Deprecated.
use
FilterContext.FilterContextBuilder instead |
FilterContext(AsyncHandler<T> asyncHandler,
Request request,
HttpResponseStatus responseStatus)
Deprecated.
use
FilterContext.FilterContextBuilder instead |
FilterContext(AsyncHandler<T> asyncHandler,
Request request,
IOException ioException)
Deprecated.
use
FilterContext.FilterContextBuilder instead |
Modifier and Type | Method and Description |
---|---|
AsyncHandler<T> |
getAsyncHandler()
Return the original or decorated
AsyncHandler |
IOException |
getIOException()
Return the
IOException |
Request |
getRequest()
Return the original or decorated
Request |
HttpResponseStatus |
getResponseStatus()
Return the unprocessed response's
HttpResponseStatus |
boolean |
replayRequest()
Return true if the current response's processing needs to be interrupted and a new
Request be executed. |
public FilterContext(AsyncHandler<T> asyncHandler, Request request)
FilterContext.FilterContextBuilder
insteadFilterContext
asyncHandler
- an AsyncHandler
request
- a Request
public FilterContext(AsyncHandler<T> asyncHandler, Request request, IOException ioException)
FilterContext.FilterContextBuilder
insteadFilterContext
asyncHandler
- an AsyncHandler
request
- a Request
ioException
- an IOException
public FilterContext(AsyncHandler<T> asyncHandler, Request request, HttpResponseStatus responseStatus)
FilterContext.FilterContextBuilder
insteadFilterContext
asyncHandler
- an AsyncHandler
request
- a Request
responseStatus
- a HttpResponseStatus
public FilterContext(AsyncHandler<T> asyncHandler, Request request, boolean replayRequest)
FilterContext.FilterContextBuilder
insteadFilterContext
asyncHandler
- an AsyncHandler
request
- a Request
replayRequest
- true if the current response processing needs to be interrupted, and a new Request
be processed.public AsyncHandler<T> getAsyncHandler()
AsyncHandler
AsyncHandler
public Request getRequest()
Request
Request
public HttpResponseStatus getResponseStatus()
HttpResponseStatus
HttpResponseStatus
public boolean replayRequest()
Request
be executed.Request
be executed.public IOException getIOException()
IOException
IOException
Copyright © 2016. All rights reserved.