Class JettyClientCall


public class JettyClientCall extends ClientCall
HTTP client connector call based on Jetty's HttpRequest class.
Author:
Jerome Louvel, Tal Liron
  • Constructor Details

    • JettyClientCall

      public JettyClientCall(HttpClientHelper helper, String method, String requestUri) throws IOException
      Constructor.
      Parameters:
      helper - The parent HTTP client helper.
      method - The method name.
      requestUri - The request URI.
      Throws:
      IOException
  • Method Details

    • getRequest

      public org.eclipse.jetty.client.Request getRequest()
      Returns the HTTP request.
      Returns:
      The HTTP request.
    • getResponse

      public org.eclipse.jetty.client.Response getResponse()
      Returns the HTTP response.
      Returns:
      The HTTP response.
    • getInputStreamResponseListener

      public org.eclipse.jetty.client.InputStreamResponseListener getInputStreamResponseListener()
      Returns the input stream response listener.
      Returns:
      The input stream response listener.
    • getReasonPhrase

      public String getReasonPhrase()
      Description copied from class: Call
      Returns the reason phrase.
      Overrides:
      getReasonPhrase in class Call
      Returns:
      The reason phrase.
    • getRequestEntityStream

      public OutputStream getRequestEntityStream()
      Description copied from class: ClientCall
      Returns the request entity stream if it exists.
      Specified by:
      getRequestEntityStream in class ClientCall
      Returns:
      The request entity stream if it exists.
    • getRequestHeadStream

      public OutputStream getRequestHeadStream()
      Description copied from class: ClientCall
      Returns the request head stream if it exists.
      Specified by:
      getRequestHeadStream in class ClientCall
      Returns:
      The request head stream if it exists.
    • getResponseEntityStream

      public InputStream getResponseEntityStream(long size)
      Description copied from class: ClientCall
      Returns the response entity stream if it exists.
      Specified by:
      getResponseEntityStream in class ClientCall
      Parameters:
      size - The expected entity size or -1 if unknown.
      Returns:
      The response entity stream if it exists.
    • getResponseEntity

      public Representation getResponseEntity(Response response)
      Returns the response entity if available. Note that no metadata is associated by default, you have to manually set them from your headers. As a jetty client decodes the input stream on the fly, we have to clear the Variant.getEncodings() to avoid decoding the input stream another time.
      Overrides:
      getResponseEntity in class ClientCall
      Parameters:
      response - the Response to get the entity from
      Returns:
      The response entity if available.
    • getResponseHeaders

      public Series<Header> getResponseHeaders()
      Returns the modifiable list of response headers.
      Overrides:
      getResponseHeaders in class Call
      Returns:
      The modifiable list of response headers.
    • getServerAddress

      public String getServerAddress()
      Returns the response address.
      Corresponds to the IP address of the responding server.
      Overrides:
      getServerAddress in class Call
      Returns:
      The response address.
    • getStatusCode

      public int getStatusCode()
      Returns the response status code.
      Overrides:
      getStatusCode in class Call
      Returns:
      The response status code.
    • sendRequest

      public Status sendRequest(Request request)
      Sends the request to the client. Commits the request line, headers, and optional entity and send them over the network.
      Overrides:
      sendRequest in class ClientCall
      Parameters:
      request - The high-level request.
      Returns:
      The result status.
    • sendRequest

      public void sendRequest(Request request, Response response, Uniform callback) throws Exception
      Description copied from class: ClientCall
      Sends the request to the client. Commits the request line, headers and optional entity and send them over the network.
      Overrides:
      sendRequest in class ClientCall
      Parameters:
      request - The high-level request.
      response - The high-level response.
      callback - The callback invoked upon request completion.
      Throws:
      Exception