Top Description Methods
org.eclipse.jetty.client

public Interface ProtocolHandler

Known Direct Implementers
org.eclipse.jetty.client.RedirectProtocolHandler, org.eclipse.jetty.client.UpgradeProtocolHandler, org.eclipse.jetty.client.AuthenticationProtocolHandler, org.eclipse.jetty.client.ContinueProtocolHandler, org.eclipse.jetty.client.EarlyHintsProtocolHandler, org.eclipse.jetty.client.ProcessingProtocolHandler

A protocol handler performs HTTP protocol operations on behalf of the application, typically like a browser would.

A typical example is handling HTTP redirects. HttpClient could just return the redirect response to the application, but the application would have to implement the redirect functionality (while browsers do this automatically).

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this protocol handler can handle the given request and response
accept
(Request
the request to accept
request
,
Response
the response to accept
response
)

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

public String

Returns:

a unique name among protocol handlers
getName
()

Get a unique name among protocol handlers.

public Response.Listener
getResponseListener()

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

Method Detail

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

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

getNameback to summary
public String getName()

Get a unique name among protocol handlers.

Returns:String

a unique name among protocol handlers

getResponseListenerback to summary
public Response.Listener getResponseListener()
Returns:Response.Listener

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