public class RedirectProtocolHandler extends Response.Listener.Adapter implements ProtocolHandler
A protocol handler that handles redirect status codes 301, 302, 303, 307 and 308.
Response.Listener.Adapter| Constructor and Description |
|---|
RedirectProtocolHandler(HttpClient client) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Request request,
Response response)
Inspects the given
request and response
to detect whether this protocol handler should handle them. |
String |
getName() |
Response.Listener |
getResponseListener() |
void |
onComplete(Result result)
Callback method invoked when the request and the response have been processed,
either successfully or not.
|
boolean |
onHeader(Response response,
HttpField field)
Callback method invoked when a response header has been received and parsed,
returning whether the header should be processed or not.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonBegin, onContent, onFailure, onHeaders, onSuccessonContentonContentonBeforeContentpublic static final String NAME
public RedirectProtocolHandler(HttpClient client)
public String getName()
getName in interface ProtocolHandlerpublic boolean accept(Request request, Response response)
ProtocolHandlerInspects the given request and response
to detect whether this protocol handler should handle them.
For example, a redirect protocol handler can inspect the response code and return true if it is a redirect response code.
This method is being called just after the response line has been parsed, and before the response headers are available.
accept in interface ProtocolHandlerrequest - the request to acceptresponse - the response to acceptpublic Response.Listener getResponseListener()
getResponseListener in interface ProtocolHandlerpublic boolean onHeader(Response response, HttpField field)
Response.HeaderListeneronHeader in interface Response.HeaderListeneronHeader in interface Response.Listenerresponse - the response containing the response line data and the headers so farfield - the header receivedpublic void onComplete(Result result)
Response.CompleteListener
The result parameter contains the request, the response, and eventual failures.
Requests may complete after response, for example in case of big uploads that are
discarded or read asynchronously by the server.
This method is always invoked after Response.SuccessListener.onSuccess(Response) or
Response.FailureListener.onFailure(Response, Throwable), and only when request indicates that
it is completed.
onComplete in interface Response.CompleteListeneronComplete in interface Response.Listenerresult - the result of the request / response exchangeCopyright © 2010 - 2020 Adobe. All Rights Reserved