Class JettyConnector

    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • client

        private final org.eclipse.jetty.client.HttpClient client
      • cookieStore

        private final java.net.CookieStore cookieStore
    • Constructor Detail

      • JettyConnector

        JettyConnector​(javax.ws.rs.client.Client jaxrsClient,
                       javax.ws.rs.core.Configuration config)
        Create the new Jetty client connector.
        Parameters:
        jaxrsClient - JAX-RS client instance, for which the connector is created.
        config - client configuration.
    • Method Detail

      • getProxyUri

        private static java.net.URI getProxyUri​(java.lang.Object proxy)
      • getHttpClient

        public org.eclipse.jetty.client.HttpClient getHttpClient()
        Get the HttpClient.
        Returns:
        the HttpClient.
      • getCookieStore

        public java.net.CookieStore getCookieStore()
        Get the CookieStore.
        Returns:
        the CookieStore instance or null when JettyClientProperties.DISABLE_COOKIES set to true.
      • apply

        public ClientResponse apply​(ClientRequest jerseyRequest)
                             throws javax.ws.rs.ProcessingException
        Description copied from interface: Connector
        Synchronously process client request into a response. The method is used by Jersey client runtime to synchronously send a request and receive a response.
        Specified by:
        apply in interface Connector
        Specified by:
        apply in interface Inflector<ClientRequest,​ClientResponse>
        Parameters:
        jerseyRequest - Jersey client request to be sent.
        Returns:
        Jersey client response received for the client request.
        Throws:
        javax.ws.rs.ProcessingException - in case of any invocation failure.
      • processResponseHeaders

        private static void processResponseHeaders​(org.eclipse.jetty.http.HttpFields respHeaders,
                                                   ClientResponse jerseyResponse)
      • translateRequest

        private org.eclipse.jetty.client.api.Request translateRequest​(ClientRequest clientRequest)
      • writeOutBoundHeaders

        private static java.util.Map<java.lang.String,​java.lang.String> writeOutBoundHeaders​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> headers,
                                                                                                   org.eclipse.jetty.client.api.Request request)
      • getBytesProvider

        private org.eclipse.jetty.client.api.ContentProvider getBytesProvider​(ClientRequest clientRequest)
      • getStreamProvider

        private org.eclipse.jetty.client.api.ContentProvider getStreamProvider​(ClientRequest clientRequest)
      • processContent

        private void processContent​(ClientRequest clientRequest,
                                    org.eclipse.jetty.client.api.ContentProvider entity)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • apply

        public java.util.concurrent.Future<?> apply​(ClientRequest jerseyRequest,
                                                    AsyncConnectorCallback callback)
        Description copied from interface: Connector
        Asynchronously process client request into a response. The method is used by Jersey client runtime to asynchronously send a request and receive a response.
        Specified by:
        apply in interface Connector
        Parameters:
        jerseyRequest - Jersey client request to be sent.
        callback - Jersey asynchronous connector callback to asynchronously receive the request processing result (either a response or a failure).
        Returns:
        asynchronously executed task handle.
      • getName

        public java.lang.String getName()
        Description copied from interface: Connector
        Get name of current connector. Should contain identification of underlying specification and optionally version number. Will be used in User-Agent header.
        Specified by:
        getName in interface Connector
        Returns:
        name of current connector. Returning null or empty string means not including this information in a generated "User-Agent" header.
      • close

        public void close()
        Description copied from interface: Connector
        Close connector and release all it's internally associated resources.
        Specified by:
        close in interface Connector