Class RedirectProtocolHandler
- All Implemented Interfaces:
 EventListener, ProtocolHandler, Response.AsyncContentListener, Response.BeginListener, Response.CompleteListener, Response.ContentListener, Response.ContentSourceListener, Response.FailureListener, Response.HeaderListener, Response.HeadersListener, Response.Listener, Response.ResponseListener, Response.SuccessListener
A protocol handler that handles redirect status codes 301, 302, 303, 307 and 308.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanInspects the givenrequestandresponseto detect whether this protocol handler should handle them.getName()Get a unique name among protocol handlers.voidonComplete(Result result) Callback method invoked when the request and the response have been processed, either successfully or not.booleanCallback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.voidCallback method invoked when the whole response has been successfully received.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Response.AsyncContentListener
onContentSourceMethods inherited from interface Response.ContentListener
onContentMethods inherited from interface Response.Listener
onBegin, onContent, onFailure, onHeaders 
- 
Field Details
- 
NAME
- See Also:
 
 
 - 
 - 
Constructor Details
- 
RedirectProtocolHandler
 
 - 
 - 
Method Details
- 
getName
Description copied from interface:ProtocolHandlerGet a unique name among protocol handlers.- Specified by:
 getNamein interfaceProtocolHandler- Returns:
 - a unique name among protocol handlers
 
 - 
accept
Description copied from interface:ProtocolHandlerInspects the given
requestandresponseto 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.
- Specified by:
 acceptin interfaceProtocolHandler- Parameters:
 request- the request to acceptresponse- the response to accept- Returns:
 - true if this protocol handler can handle the given request and response
 
 - 
getResponseListener
- Specified by:
 getResponseListenerin interfaceProtocolHandler- Returns:
 - a response listener that will handle the request and response on behalf of the application.
 
 - 
onHeader
Description copied from interface:Response.HeaderListenerCallback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.- Specified by:
 onHeaderin interfaceResponse.HeaderListener- Specified by:
 onHeaderin interfaceResponse.Listener- Parameters:
 response- the response containing the response line data and the headers so farfield- the header received- Returns:
 - true to process the header, false to skip processing of the header
 
 - 
onSuccess
Description copied from interface:Response.SuccessListenerCallback method invoked when the whole response has been successfully received.- Specified by:
 onSuccessin interfaceResponse.Listener- Specified by:
 onSuccessin interfaceResponse.SuccessListener- Parameters:
 response- the response containing the response line data and the headers
 - 
onComplete
Description copied from interface:Response.CompleteListenerCallback method invoked when the request and the response have been processed, either successfully or not.The
resultparameter 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)orResponse.FailureListener.onFailure(Response, Throwable), and only when request indicates that it is completed.- Specified by:
 onCompletein interfaceResponse.CompleteListener- Specified by:
 onCompletein interfaceResponse.Listener- Parameters:
 result- the result of the request / response exchange
 
 -