Package org.xnio.http
Class HttpUpgrade
java.lang.Object
org.xnio.http.HttpUpgrade
Simple HTTP client that can perform a HTTP upgrade. This is not a general purpose HTTP
client, all it can do is upgrade a HTTP
- Author:
- Stuart Douglas
-
Method Summary
Modifier and TypeMethodDescriptionstatic IoFuture
<StreamConnection> performUpgrade
(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String, String> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker) Connects to the target server using HTTP upgrade.static IoFuture
<StreamConnection> performUpgrade
(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String, List<String>> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker) Connects to the target server using HTTP upgrade.static IoFuture
<SslConnection> performUpgrade
(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String, String> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker) Perform a HTTP upgrade that results in a SSL secured connection.static IoFuture
<SslConnection> performUpgrade
(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String, List<String>> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker) Perform a HTTP upgrade that results in a SSL secured connection.static <T extends StreamConnection>
IoFuture<T> performUpgrade
(T connection, URI uri, Map<String, String> headers, ChannelListener<? super StreamConnection> openListener, HandshakeChecker handshakeChecker) Performs a HTTP upgrade on an existing connection.static <T extends StreamConnection>
IoFuture<T> performUpgrade
(T connection, URI uri, Map<String, List<String>> headers, ChannelListener<? super StreamConnection> openListener, ExtendedHandshakeChecker handshakeChecker) Performs a HTTP upgrade on an existing connection.
-
Method Details
-
performUpgrade
public static IoFuture<SslConnection> performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String, String> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker) Perform a HTTP upgrade that results in a SSL secured connection. This method should be used if the target endpoint is using https- Parameters:
worker
- The workerssl
- The XnioSsl instancebindAddress
- The bind addressuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donebindListener
- The bind listener that is invoked when the socket is boundoptionMap
- The option map for the connectionhandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-
performUpgrade
public static IoFuture<SslConnection> performUpgrade(XnioWorker worker, XnioSsl ssl, InetSocketAddress bindAddress, URI uri, Map<String, List<String>> headers, ChannelListener<? super SslConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker) Perform a HTTP upgrade that results in a SSL secured connection. This method should be used if the target endpoint is using https- Parameters:
worker
- The workerssl
- The XnioSsl instancebindAddress
- The bind addressuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donebindListener
- The bind listener that is invoked when the socket is boundoptionMap
- The option map for the connectionhandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-
performUpgrade
public static IoFuture<StreamConnection> performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String, String> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, HandshakeChecker handshakeChecker) Connects to the target server using HTTP upgrade.- Parameters:
worker
- The workerbindAddress
- The bind addressuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donebindListener
- The bind listener that is invoked when the socket is boundoptionMap
- The option map for the connectionhandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-
performUpgrade
public static IoFuture<StreamConnection> performUpgrade(XnioWorker worker, InetSocketAddress bindAddress, URI uri, Map<String, List<String>> headers, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap, ExtendedHandshakeChecker handshakeChecker) Connects to the target server using HTTP upgrade.- Parameters:
worker
- The workerbindAddress
- The bind addressuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donebindListener
- The bind listener that is invoked when the socket is boundoptionMap
- The option map for the connectionhandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-
performUpgrade
public static <T extends StreamConnection> IoFuture<T> performUpgrade(T connection, URI uri, Map<String, String> headers, ChannelListener<? super StreamConnection> openListener, HandshakeChecker handshakeChecker) Performs a HTTP upgrade on an existing connection.- Parameters:
connection
- The existing connection to upgradeuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donehandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-
performUpgrade
public static <T extends StreamConnection> IoFuture<T> performUpgrade(T connection, URI uri, Map<String, List<String>> headers, ChannelListener<? super StreamConnection> openListener, ExtendedHandshakeChecker handshakeChecker) Performs a HTTP upgrade on an existing connection.- Parameters:
connection
- The existing connection to upgradeuri
- The URI to connect toheaders
- Any additional headers to include in the upgrade request. This must include anUpgrade
header that specifies the type of upgrade being performedopenListener
- The open listener that is invoked once the HTTP upgrade is donehandshakeChecker
- A handshake checker that can be supplied to verify that the server returned a valid response to the upgrade request- Returns:
- An IoFuture of the connection
-