Package com.ning.http.client.filter
Class FilterContext<T>
java.lang.Object
com.ning.http.client.filter.FilterContext<T>
A
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.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturn the original or decoratedAsyncHandlerReturn theIOExceptionReturn the original or decoratedRequestReturn the responseHttpResponseHeadersReturn the unprocessed response'sHttpResponseStatusbooleanReturn true if the current response's processing needs to be interrupted and a newRequestbe executed.
-
Method Details
-
getAsyncHandler
Return the original or decoratedAsyncHandler- Returns:
- the original or decorated
AsyncHandler
-
getRequest
Return the original or decoratedRequest- Returns:
- the original or decorated
Request
-
getResponseStatus
Return the unprocessed response'sHttpResponseStatus- Returns:
- the unprocessed response's
HttpResponseStatus
-
getResponseHeaders
Return the responseHttpResponseHeaders -
replayRequest
public boolean replayRequest()Return true if the current response's processing needs to be interrupted and a newRequestbe executed.- Returns:
- true if the current response's processing needs to be interrupted and a new
Requestbe executed.
-
getIOException
Return theIOException- Returns:
- the
IOException
-