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
AFilterContextcan be used to decorateRequestandAsyncHandlerfrom a list ofRequestFilter.RequestFiltergets executed before the HTTP request is made to the remote server. Once the response bytes are received, aFilterContextis then passed to the list ofResponseFilter.ResponseFiltergets invoked before the response gets processed, e.g. before authorization, redirection and invocation ofAsyncHandlergets processed.
InvokinggetResponseStatus()returns an instance ofHttpResponseStatusthat 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. TheAsyncHttpClientwill interrupt the processing and "replay" the associatedRequestinstance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFilterContext.FilterContextBuilder<T>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncHandler<T>getAsyncHandler()@Nullable IOExceptiongetIOException()RequestgetRequest()@Nullable io.netty.handler.codec.http.HttpHeadersgetResponseHeaders()@Nullable HttpResponseStatusgetResponseStatus()booleanreplayRequest()
-
-
-
Method Detail
-
getAsyncHandler
public AsyncHandler<T> getAsyncHandler()
- Returns:
- the original or decorated
AsyncHandler
-
getResponseStatus
@Nullable public @Nullable HttpResponseStatus getResponseStatus()
- Returns:
- the unprocessed response's
HttpResponseStatus
-
getResponseHeaders
@Nullable public @Nullable 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
Requestbe executed.
-
getIOException
@Nullable public @Nullable IOException getIOException()
- Returns:
- the
IOException
-
-