Package org.asynchttpclient.filter
Class FilterContext<T>
- java.lang.Object
-
- org.asynchttpclient.filter.FilterContext<T>
-
- Type Parameters:
T
- the handler result type
public class FilterContext<T> extends Object
AFilterContext
can be used to decorateRequest
andAsyncHandler
from a list ofRequestFilter
.RequestFilter
gets executed before the HTTP request is made to the remote server. Once the response bytes are received, aFilterContext
is then passed to the list ofResponseFilter
.ResponseFilter
gets invoked before the response gets processed, e.g. before authorization, redirection and invocation ofAsyncHandler
gets processed.
InvokinggetResponseStatus()
returns an instance ofHttpResponseStatus
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 aFilterContext
. TheAsyncHttpClient
will interrupt the processing and "replay" the associatedRequest
instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FilterContext.FilterContextBuilder<T>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncHandler<T>
getAsyncHandler()
IOException
getIOException()
Request
getRequest()
io.netty.handler.codec.http.HttpHeaders
getResponseHeaders()
HttpResponseStatus
getResponseStatus()
boolean
replayRequest()
-
-
-
Method Detail
-
getAsyncHandler
public AsyncHandler<T> getAsyncHandler()
- Returns:
- the original or decorated
AsyncHandler
-
getResponseStatus
public HttpResponseStatus getResponseStatus()
- Returns:
- the unprocessed response's
HttpResponseStatus
-
getResponseHeaders
public io.netty.handler.codec.http.HttpHeaders getResponseHeaders()
- Returns:
- the response
HttpHeaders
-
replayRequest
public boolean replayRequest()
- Returns:
- true if the current response's processing needs to be interrupted and a new
Request
be executed.
-
getIOException
public IOException getIOException()
- Returns:
- the
IOException
-
-