org.codegist.crest
Class HttpClientRestService

java.lang.Object
  extended by org.codegist.crest.HttpClientRestService
All Implemented Interfaces:
Disposable, RestService

public class HttpClientRestService
extends Object
implements RestService, Disposable

RestService implementation based on ASF HttpClient.

This implementation is preferable to the default one DefaultRestService.

Author:
Laurent Gilles (laurent.gilles@codegist.org)
See Also:
HttpClient

Constructor Summary
HttpClientRestService()
          Construct a HttpClientRestService based on DefaultHttpClient.DefaultHttpClient().
HttpClientRestService(HttpClient http)
           
 
Method Summary
 void dispose()
           
 HttpResponse exec(HttpRequest httpRequest)
          Execute the given request.
static RestService newRestService(int maxConcurrentConnection, int maxConnectionPerRoute)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClientRestService

public HttpClientRestService()
Construct a HttpClientRestService based on DefaultHttpClient.DefaultHttpClient().


HttpClientRestService

public HttpClientRestService(HttpClient http)
Method Detail

exec

public HttpResponse exec(HttpRequest httpRequest)
                  throws HttpException
Description copied from interface: RestService
Execute the given request.

Specified by:
exec in interface RestService
Parameters:
httpRequest - Request to fire
Returns:
The response.
Throws:
HttpException - For any problem occuring during the http transaction, and when response status code is not HTTP OK 200

newRestService

public static RestService newRestService(int maxConcurrentConnection,
                                         int maxConnectionPerRoute)

dispose

public void dispose()
Specified by:
dispose in interface Disposable


Copyright © 2011. All Rights Reserved.