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

public Class HttpProxy

extends Proxy
Class Inheritance
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, .URI, java.util.List, .Map, .Objects, java.util.concurrent.TimeUnit, org.eclipse.jetty.client.internal.TunnelRequest, org.eclipse.jetty.client.transport.HttpConversation, .HttpDestination, .HttpRequest, org.eclipse.jetty.http.HttpHeader, .HttpScheme, .HttpStatus, org.eclipse.jetty.io.ClientConnectionFactory, .ClientConnector, .EndPoint, org.eclipse.jetty.util.Attachable, .Promise, org.eclipse.jetty.util.ssl.SslContextFactory, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
HttpProxy.CreateTunnelPromise

Creates a tunnel using HTTP CONNECT.

private class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public
HttpProxy(String host, int port)

public
HttpProxy(Origin.Address address, boolean secure)

public
HttpProxy(Origin.Address address, boolean secure, Origin.Protocol protocol)

public
HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory)

public
HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)

private
HttpProxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)

Method Summary

Modifier and TypeMethod and Description
public URI
private boolean
isHTTP2(String protocol)

public ClientConnectionFactory
private boolean
protocolMatches(String protocol, List<String> protocols)

public boolean
requiresTunnel(Origin serverOrigin)

Inherited from org.eclipse.jetty.client.ProxyConfiguration.Proxy:
getAddressgetExcludedAddressesgetIncludedAddressesgetOrigingetProtocolgetSslContextFactoryisSecurematchestoString

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

HttpProxyback to summary
public HttpProxy(String host, int port)
HttpProxyback to summary
public HttpProxy(Origin.Address address, boolean secure)
HttpProxyback to summary
public HttpProxy(Origin.Address address, boolean secure, Origin.Protocol protocol)
HttpProxyback to summary
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory)
HttpProxyback to summary
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)
HttpProxyback to summary
private HttpProxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)

Method Detail

getURIback to summary
public URI getURI()

Overrides org.eclipse.jetty.client.ProxyConfiguration.Proxy.getURI.

Returns:URI

Doc from org.eclipse.jetty.client.ProxyConfiguration.Proxy.getURI.

an URI representing this proxy, or null if no URI can represent this proxy

Annotations
@Override
isHTTP2back to summary
private boolean isHTTP2(String protocol)
newClientConnectionFactoryback to summary
public ClientConnectionFactory newClientConnectionFactory(ClientConnectionFactory connectionFactory)

Implements abstract org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

Parameters
connectionFactory:ClientConnectionFactory

Doc from org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

the nested ClientConnectionFactory

Returns:ClientConnectionFactory

Doc from org.eclipse.jetty.client.ProxyConfiguration.Proxy.newClientConnectionFactory.

a new ClientConnectionFactory for this Proxy

Annotations
@Override
protocolMatchesback to summary
private boolean protocolMatches(String protocol, List<String> protocols)
requiresTunnelback to summary
public boolean requiresTunnel(Origin serverOrigin)
org.eclipse.jetty.client back to summary

private Class HttpProxy.CreateTunnelPromise

extends Object
implements Promise<Connection>
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Promise

Creates a tunnel using HTTP CONNECT.

It is implemented as a promise because it needs to establish the tunnel after the TCP connection is succeeded, and needs to notify the nested promise when the tunnel is established (or failed).

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final ClientConnectionFactory
private final Map<String, Object>
private final HttpDestination
private final EndPoint
private final Promise<Connection>

Constructor Summary

AccessConstructor and Description
private
CreateTunnelPromise(ClientConnectionFactory connectionFactory, EndPoint endPoint, HttpDestination destination, Promise<Connection> promise, Map<String, Object> context)

Method Summary

Modifier and TypeMethod and Description
public void
failed(Throwable
the reason for the operation failure
x
)

Overrides default org.eclipse.jetty.util.Promise.failed.

Callback invoked when the operation fails.

public void
succeeded(Connection
the context
connection
)

Overrides default org.eclipse.jetty.util.Promise.succeeded.

Callback invoked when the operation completes.

private void
tunnel(Connection connection)

private void
tunnelFailed(EndPoint endPoint, Throwable failure)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionFactoryback to summary
private final ClientConnectionFactory connectionFactory
contextback to summary
private final Map<String, Object> context
destinationback to summary
private final HttpDestination destination
endPointback to summary
private final EndPoint endPoint
promiseback to summary
private final Promise<Connection> promise

Constructor Detail

CreateTunnelPromiseback to summary
private CreateTunnelPromise(ClientConnectionFactory connectionFactory, EndPoint endPoint, HttpDestination destination, Promise<Connection> promise, Map<String, Object> context)

Method Detail

failedback to summary
public void failed(Throwable x)

Overrides default org.eclipse.jetty.util.Promise.failed.

Doc from org.eclipse.jetty.util.Promise.failed.

Callback invoked when the operation fails.

Parameters
x:Throwable

the reason for the operation failure

Annotations
@Override
succeededback to summary
public void succeeded(Connection connection)

Overrides default org.eclipse.jetty.util.Promise.succeeded.

Doc from org.eclipse.jetty.util.Promise.succeeded.

Callback invoked when the operation completes.

Parameters
connection:Connection

the context

Annotations
@Override
tunnelback to summary
private void tunnel(Connection connection)
tunnelFailedback to summary
private void tunnelFailed(EndPoint endPoint, Throwable failure)
tunnelSucceededback to summary
private void tunnelSucceeded(EndPoint endPoint)
org.eclipse.jetty.client back to summary

private Class HttpProxy.CreateTunnelPromise.TunnelListener

extends Object
implements Listener
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.client.HttpProxy.CreateTunnelPromise.TunnelListener
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

Field Summary

Modifier and TypeField and Description
private final HttpConversation

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
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 void
onHeaders(Response
the response containing the response line data and the headers
response
)

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

Callback method invoked when all the response headers have been received and parsed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conversationback to summary
private final HttpConversation conversation

Constructor Detail

TunnelListenerback to summary
private TunnelListener(Request request)

Method Detail

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
onHeadersback to summary
public void onHeaders(Response response)

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

Doc from org.eclipse.jetty.client.Response.HeadersListener.onHeaders.

Callback method invoked when all the response headers have been received and parsed.

Parameters
response:Response

the response containing the response line data and the headers

Annotations
@Override
org.eclipse.jetty.client back to summary

private Class HttpProxy.HttpProxyClientConnectionFactory

extends Object
implements ClientConnectionFactory
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.client.HttpProxy.HttpProxyClientConnectionFactory
All Implemented Interfaces
org.eclipse.jetty.io.ClientConnectionFactory

Field Summary

Modifier and TypeField and Description
private final ClientConnectionFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Connection
newConnection(EndPoint
the org.eclipse.jetty.io.EndPoint to link the newly created connection to
endPoint
,
Map<String, Object>
the context data to create the connection
context
)

Implements org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

private Connection
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionFactoryback to summary
private final ClientConnectionFactory connectionFactory

Constructor Detail

HttpProxyClientConnectionFactoryback to summary
private HttpProxyClientConnectionFactory(ClientConnectionFactory connectionFactory)

Method Detail

newConnectionback to summary
public Connection newConnection(EndPoint endPoint, Map<String, Object> context) throws IOException

Implements org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

Parameters
endPoint:EndPoint

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

the org.eclipse.jetty.io.EndPoint to link the newly created connection to

context:Map<String, Object>

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

the context data to create the connection

Returns:Connection

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

a new Connection

Annotations
@Override
Exceptions
IOException:

Doc from org.eclipse.jetty.io.ClientConnectionFactory.newConnection.

if the connection cannot be created

newProxyConnectionback to summary
private Connection newProxyConnection(EndPoint endPoint, Map<String, Object> context) throws IOException
org.eclipse.jetty.client back to summary

private Class HttpProxy.ProxyConnection

extends Object
implements Connection, Attachable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Attachable, org.eclipse.jetty.client.Connection, java.io.Closeable, java.lang.AutoCloseable

Field Summary

Modifier and TypeField and Description
private Object
private final Connection
private final Destination
private final Promise<Connection>

Constructor Summary

AccessConstructor and Description
private
ProxyConnection(Destination destination, Connection connection, Promise<Connection> promise)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.eclipse.jetty.client.Connection.close.

Closes this stream and releases any system resources associated with it.

public Object
public SocketAddress
public SocketAddress
public boolean
public void
send(Request
the request to send
request
,
Response.CompleteListener
the response listener
listener
)

Implements org.eclipse.jetty.client.Connection.send.

Sends a request with an associated response listener.

public void
setAttachment(Object
the object to attach to this instance
obj
)

Implements org.eclipse.jetty.util.Attachable.setAttachment.

Attaches the given object to this stream for later retrieval.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attachmentback to summary
private Object attachment
connectionback to summary
private final Connection connection
destinationback to summary
private final Destination destination
promiseback to summary
private final Promise<Connection> promise

Constructor Detail

ProxyConnectionback to summary
private ProxyConnection(Destination destination, Connection connection, Promise<Connection> promise)

Method Detail

closeback to summary
public void close()

Implements org.eclipse.jetty.client.Connection.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
getAttachmentback to summary
public Object getAttachment()

Implements org.eclipse.jetty.util.Attachable.getAttachment.

Returns:Object

Doc from org.eclipse.jetty.util.Attachable.getAttachment.

the object attached to this instance

Annotations
@Override
getLocalSocketAddressback to summary
public SocketAddress getLocalSocketAddress()

Overrides default org.eclipse.jetty.client.Connection.getLocalSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.client.Connection.getLocalSocketAddress.

the local socket address associated with the connection

Annotations
@Override
getRemoteSocketAddressback to summary
public SocketAddress getRemoteSocketAddress()

Overrides default org.eclipse.jetty.client.Connection.getRemoteSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.client.Connection.getRemoteSocketAddress.

the remote socket address associated with the connection

Annotations
@Override
isClosedback to summary
public boolean isClosed()

Implements org.eclipse.jetty.client.Connection.isClosed.

Returns:boolean

Doc from org.eclipse.jetty.client.Connection.isClosed.

whether this connection has been closed

Annotations
@Override
sendback to summary
public void send(Request request, Response.CompleteListener listener)

Implements org.eclipse.jetty.client.Connection.send.

Doc from org.eclipse.jetty.client.Connection.send.

Sends a request with an associated response listener.

Request#send(Response.CompleteListener) will eventually call this method to send the request. It is exposed to allow applications to send requests via unpooled connections.

Parameters
request:Request

the request to send

listener:Response.CompleteListener

the response listener

Annotations
@Override
setAttachmentback to summary
public void setAttachment(Object obj)

Implements org.eclipse.jetty.util.Attachable.setAttachment.

Doc from org.eclipse.jetty.util.Attachable.setAttachment.

Attaches the given object to this stream for later retrieval.

Parameters
obj:Object

the object to attach to this instance

Annotations
@Override
org.eclipse.jetty.client back to summary

private Class HttpProxy.TunnelPromise

extends Object
implements Promise<Connection>
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Promise

Field Summary

Modifier and TypeField and Description
private final Response.CompleteListener
private final Promise<Connection>
private final Request

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
failed(Throwable
the reason for the operation failure
x
)

Overrides default org.eclipse.jetty.util.Promise.failed.

Callback invoked when the operation fails.

public void
succeeded(Connection
the context
connection
)

Overrides default org.eclipse.jetty.util.Promise.succeeded.

Callback invoked when the operation completes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

listenerback to summary
private final Response.CompleteListener listener
promiseback to summary
private final Promise<Connection> promise
requestback to summary
private final Request request

Constructor Detail

TunnelPromiseback to summary
private TunnelPromise(Request request, Response.CompleteListener listener, Promise<Connection> promise)

Method Detail

failedback to summary
public void failed(Throwable x)

Overrides default org.eclipse.jetty.util.Promise.failed.

Doc from org.eclipse.jetty.util.Promise.failed.

Callback invoked when the operation fails.

Parameters
x:Throwable

the reason for the operation failure

Annotations
@Override
succeededback to summary
public void succeeded(Connection connection)

Overrides default org.eclipse.jetty.util.Promise.succeeded.

Doc from org.eclipse.jetty.util.Promise.succeeded.

Callback invoked when the operation completes.

Parameters
connection:Connection

the context

Annotations
@Override