Top Description Fields Constructors Methods
org.eclipse.jetty.client

public Class RedirectProtocolHandler

extends Object
implements ProtocolHandler, Listener
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.client.Response.Listener, org.eclipse.jetty.client.Response.CompleteListener, org.eclipse.jetty.client.Response.ResponseListener, java.util.EventListener, org.eclipse.jetty.client.Response.FailureListener, org.eclipse.jetty.client.Response.SuccessListener, org.eclipse.jetty.client.Response.ContentListener, org.eclipse.jetty.client.Response.AsyncContentListener, org.eclipse.jetty.client.Response.ContentSourceListener, org.eclipse.jetty.client.Response.HeadersListener, org.eclipse.jetty.client.Response.HeaderListener, org.eclipse.jetty.client.Response.BeginListener, org.eclipse.jetty.client.ProtocolHandler
Imports
org.eclipse.jetty.http.HttpField, .HttpHeader

A protocol handler that handles redirect status codes 301, 302, 303, 307 and 308.

Field Summary

Modifier and TypeField and Description
public static final String
private final HttpRedirector

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
accept(Request
the request to accept
request
,
Response
the response to accept
response
)

Implements org.eclipse.jetty.client.ProtocolHandler.accept.

Inspects the given request and response to detect whether this protocol handler should handle them.

public String
getName()

Implements org.eclipse.jetty.client.ProtocolHandler.getName.

Get a unique name among protocol handlers.

public Response.Listener
public void
onComplete(Result
the result of the request / response exchange
result
)

Overrides default org.eclipse.jetty.client.Response.Listener.onComplete.

Callback method invoked when the request and the response have been processed, either successfully or not.

public boolean
onHeader(Response
the response containing the response line data and the headers so far
response
,
HttpField
the header received
field
)

Overrides default org.eclipse.jetty.client.Response.Listener.onHeader.

Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.

public void
onSuccess(Response
the response containing the response line data and the headers
response
)

Overrides default org.eclipse.jetty.client.Response.Listener.onSuccess.

Callback method invoked when the whole response has been successfully received.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NAMEback to summary
public static final String NAME
redirectorback to summary
private final HttpRedirector redirector

Constructor Detail

RedirectProtocolHandlerback to summary
public RedirectProtocolHandler(HttpClient client)

Method Detail

acceptback to summary
public boolean accept(Request request, Response response)

Implements org.eclipse.jetty.client.ProtocolHandler.accept.

Doc from org.eclipse.jetty.client.ProtocolHandler.accept.

Inspects 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.

Parameters
request:Request

the request to accept

response:Response

the response to accept

Returns:boolean

true if this protocol handler can handle the given request and response

Annotations
@Override
getNameback to summary
public String getName()

Implements org.eclipse.jetty.client.ProtocolHandler.getName.

Doc from org.eclipse.jetty.client.ProtocolHandler.getName.

Get a unique name among protocol handlers.

Returns:String

a unique name among protocol handlers

Annotations
@Override
getResponseListenerback to summary
public Response.Listener getResponseListener()

Implements org.eclipse.jetty.client.ProtocolHandler.getResponseListener.

Returns:Response.Listener

Doc from org.eclipse.jetty.client.ProtocolHandler.getResponseListener.

a response listener that will handle the request and response on behalf of the application.

Annotations
@Override
onCompleteback to summary
public void onComplete(Result result)

Overrides default org.eclipse.jetty.client.Response.Listener.onComplete.

Doc from org.eclipse.jetty.client.Response.CompleteListener.onComplete.

Callback method invoked when the request and the response have been processed, either successfully or not.

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 SuccessListener#onSuccess(Response) or FailureListener#onFailure(Response, Throwable), and only when request indicates that it is completed.

Parameters
result:Result

the result of the request / response exchange

Annotations
@Override
onHeaderback to summary
public boolean onHeader(Response response, HttpField field)

Overrides default org.eclipse.jetty.client.Response.Listener.onHeader.

Doc from org.eclipse.jetty.client.Response.HeaderListener.onHeader.

Callback method invoked when a response header has been received and parsed, returning whether the header should be processed or not.

Parameters
response:Response

the response containing the response line data and the headers so far

field:HttpField

the header received

Returns:boolean

true to process the header, false to skip processing of the header

Annotations
@Override
onSuccessback to summary
public void onSuccess(Response response)

Overrides default org.eclipse.jetty.client.Response.Listener.onSuccess.

Doc from org.eclipse.jetty.client.Response.SuccessListener.onSuccess.

Callback method invoked when the whole response has been successfully received.

Parameters
response:Response

the response containing the response line data and the headers

Annotations
@Override