Module 
Package org.xnio.http

Class HttpUpgrade


  • public class HttpUpgrade
    extends java.lang.Object
    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 Detail

      • performUpgrade

        public static IoFuture<SslConnection> performUpgrade​(XnioWorker worker,
                                                             XnioSsl ssl,
                                                             java.net.InetSocketAddress bindAddress,
                                                             java.net.URI uri,
                                                             java.util.Map<java.lang.String,​java.lang.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 worker
        ssl - The XnioSsl instance
        bindAddress - The bind address
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        bindListener - The bind listener that is invoked when the socket is bound
        optionMap - The option map for the connection
        handshakeChecker - 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,
                                                             java.net.InetSocketAddress bindAddress,
                                                             java.net.URI uri,
                                                             java.util.Map<java.lang.String,​java.util.List<java.lang.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 worker
        ssl - The XnioSsl instance
        bindAddress - The bind address
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        bindListener - The bind listener that is invoked when the socket is bound
        optionMap - The option map for the connection
        handshakeChecker - 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,
                                                                java.net.InetSocketAddress bindAddress,
                                                                java.net.URI uri,
                                                                java.util.Map<java.lang.String,​java.lang.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 worker
        bindAddress - The bind address
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        bindListener - The bind listener that is invoked when the socket is bound
        optionMap - The option map for the connection
        handshakeChecker - 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,
                                                                java.net.InetSocketAddress bindAddress,
                                                                java.net.URI uri,
                                                                java.util.Map<java.lang.String,​java.util.List<java.lang.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 worker
        bindAddress - The bind address
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        bindListener - The bind listener that is invoked when the socket is bound
        optionMap - The option map for the connection
        handshakeChecker - 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 StreamConnectionIoFuture<T> performUpgrade​(T connection,
                                                                              java.net.URI uri,
                                                                              java.util.Map<java.lang.String,​java.lang.String> headers,
                                                                              ChannelListener<? super StreamConnection> openListener,
                                                                              HandshakeChecker handshakeChecker)
        Performs a HTTP upgrade on an existing connection.
        Parameters:
        connection - The existing connection to upgrade
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        handshakeChecker - 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 StreamConnectionIoFuture<T> performUpgrade​(T connection,
                                                                              java.net.URI uri,
                                                                              java.util.Map<java.lang.String,​java.util.List<java.lang.String>> headers,
                                                                              ChannelListener<? super StreamConnection> openListener,
                                                                              ExtendedHandshakeChecker handshakeChecker)
        Performs a HTTP upgrade on an existing connection.
        Parameters:
        connection - The existing connection to upgrade
        uri - The URI to connect to
        headers - Any additional headers to include in the upgrade request. This must include an Upgrade header that specifies the type of upgrade being performed
        openListener - The open listener that is invoked once the HTTP upgrade is done
        handshakeChecker - 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