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

public Interface HttpUpgrader

Known Direct Implementers
org.eclipse.jetty.client.transport.internal.ProtocolHttpUpgrader
Imports
org.eclipse.jetty.http.HttpVersion, org.eclipse.jetty.io.EndPoint, org.eclipse.jetty.util.Callback

HttpUpgrader prepares a HTTP request to upgrade from one protocol to another, and implements the upgrade mechanism.

The upgrade mechanism can be the HTTP/1.1 upgrade mechanism or the HTTP/2 extended CONNECT mechanism.

Given the differences among mechanism implementations, a request needs to be prepared before being sent to comply with the mechanism requirements (for example, add required headers, etc.).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
public static final String
PROTOCOL_ATTRIBUTE

The request attribute key for the upgrade protocol, used by the HTTP/2 extended CONNECT mechanism.

Method Summary

Modifier and TypeMethod and Description
public void
prepare(Request
the request to prepare
request
)

Prepares the request for the upgrade, for example by setting the HTTP method or by setting HTTP headers required for the upgrade.

public void
upgrade(Response
the response with the information about the upgrade
response
,
EndPoint
the EndPoint to upgrade
endPoint
,
Callback
a callback to notify of the success or failure of the upgrade
callback
)

Upgrades the given endPoint to a different protocol.

Field Detail

PROTOCOL_ATTRIBUTEback to summary
public static final String PROTOCOL_ATTRIBUTE

The request attribute key for the upgrade protocol, used by the HTTP/2 extended CONNECT mechanism.

Method Detail

prepareback to summary
public void prepare(Request request)

Prepares the request for the upgrade, for example by setting the HTTP method or by setting HTTP headers required for the upgrade.

Parameters
request:Request

the request to prepare

upgradeback to summary
public void upgrade(Response response, EndPoint endPoint, Callback callback)

Upgrades the given endPoint to a different protocol.

The success or failure of the upgrade should be communicated via the given callback.

An exception thrown by this method is equivalent to failing the callback.

Parameters
response:Response

the response with the information about the upgrade

endPoint:EndPoint

the EndPoint to upgrade

callback:Callback

a callback to notify of the success or failure of the upgrade

org.eclipse.jetty.client back to summary

public Interface HttpUpgrader.Factory


A factory for HttpUpgraders.

A Request subclass should implement this interface if it wants to create a specific HttpUpgrader.

Method Summary

Modifier and TypeMethod and Description
public HttpUpgrader

Method Detail

newHttpUpgraderback to summary
public HttpUpgrader newHttpUpgrader(HttpVersion version)