Class Client

java.lang.Object
org.forgerock.http.Client

public final class Client extends Object
An HTTP client which forwards requests to a wrapped Handler.
  • Constructor Details

    • Client

      public Client(Handler handler)
      Creates a new Client which will route HTTP requests to the provided Handler using a RootContext allocated during construction when none is provided.
      Parameters:
      handler - The HTTP handler.
    • Client

      public Client(Handler handler, Context defaultContext)
      Creates a new Client which will route HTTP requests to the provided Handler using the specified Context if none is provided.
      Parameters:
      handler - The HTTP handler.
      defaultContext - The context to pass in with HTTP request when none is provided.
  • Method Details

    • send

      public Promise<Response,NeverThrowsException> send(Request request)
      Sends an HTTP request and returns a Promise representing the pending HTTP response. The given request is automatically closed on response reception.
      Parameters:
      request - The HTTP request to send.
      Returns:
      A promise representing the pending HTTP response.
    • send

      public Promise<Response,NeverThrowsException> send(Context context, Request request)
      Sends an HTTP request and returns a Promise representing the pending HTTP response. The given request is automatically closed on response reception.
      Parameters:
      context - The associated processing context.
      request - The HTTP request to send.
      Returns:
      A promise representing the pending HTTP response.
    • sendWithoutClose

      public Promise<Response,NeverThrowsException> sendWithoutClose(Request request)
      Sends an HTTP request and returns a Promise representing the pending HTTP response.
      Parameters:
      request - The HTTP request to send.
      Returns:
      A promise representing the pending HTTP response.
    • sendWithoutClose

      public Promise<Response,NeverThrowsException> sendWithoutClose(Context context, Request request)
      Sends an HTTP request and returns a Promise representing the pending HTTP response.
      Parameters:
      context - The associated processing context.
      request - The HTTP request to send.
      Returns:
      A promise representing the pending HTTP response.