Interface HttpClient

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <Intermediate,​Final>
      com.google.common.util.concurrent.ListenableFuture<Final>
      go​(Request request, HttpResponseHandler<Intermediate,​Final> handler)
      Submit a request and process the response with the given response handler.
      <Intermediate,​Final>
      com.google.common.util.concurrent.ListenableFuture<Final>
      go​(Request request, HttpResponseHandler<Intermediate,​Final> handler, org.joda.time.Duration readTimeout)
      Submit a request and process the response with the given response handler.
    • Method Detail

      • go

        <Intermediate,​Final> com.google.common.util.concurrent.ListenableFuture<Final> go​(Request request,
                                                                                                HttpResponseHandler<Intermediate,​Final> handler)
        Submit a request and process the response with the given response handler.

        Note that the Request object passed in to the HttpClient *may* be mutated by the actual client. This is largely done by composed clients, but the contract is that mutation is possible. It is the caller's responsibility to pass in a copy of the Request object if they want to have an object that is not mutated.

        Type Parameters:
        Intermediate - The type of the intermediate results from the handler
        Final - The type of the final results that the returned ListenableFuture will contain
        Parameters:
        request - Request to process, this *may* be mutated by the client
        handler - An asynchronous response handler that will be used to process results from the http call
        Returns:
        A listenable future that will eventually provide an object of type Final
      • go

        <Intermediate,​Final> com.google.common.util.concurrent.ListenableFuture<Final> go​(Request request,
                                                                                                HttpResponseHandler<Intermediate,​Final> handler,
                                                                                                org.joda.time.Duration readTimeout)
        Submit a request and process the response with the given response handler.

        Note that the Request object passed in to the HttpClient *may* be mutated by the actual client. This is largely done by composed clients, but the contract is that mutation is possible. It is the caller's responsibility to pass in a copy of the Request object if they want to have an object that is not mutated.

        Type Parameters:
        Intermediate - The type of the intermediate results from the handler
        Final - The type of the final results that the returned ListenableFuture will contain
        Parameters:
        request - Request to process, this *may* be mutated by the client
        handler - An asynchronous response handler that will be used to process results from the http call
        readTimeout - Read timeout to use for this request. Leave null to use the default readTimeout. Set to zero to disable timeouts for this request.
        Returns:
        A listenable future that will eventually provide an object of type Final