com.scooterframework.common.http
Class HTTPClient

java.lang.Object
  extended by com.scooterframework.common.http.HTTPClient

public class HTTPClient
extends java.lang.Object

HTTPClient class acts as a HTTP client.


Field Summary
static java.lang.String DELETE
           
static java.lang.String GET
           
static java.lang.String HEAD
           
static java.lang.String OPTIONS
           
static java.lang.String POST
           
static java.lang.String PUT
           
 
Constructor Summary
HTTPClient()
           
 
Method Summary
 HTTPResponse fireHttpDeleteRequest(java.lang.String uri)
          Sends a HTTP DELETE request
 HTTPResponse fireHttpGetRequest(java.lang.String uri)
          Sends a HTTP GET request
 HTTPResponse fireHttpHeadRequest(java.lang.String uri)
          Sends a HTTP HEAD request
 HTTPResponse fireHttpOptionsRequest(java.lang.String uri)
          Sends a HTTP OPTIONS request
 HTTPResponse fireHttpPostRequest(java.lang.String uri)
          Sends a HTTP POST request
 HTTPResponse fireHttpPostRequest(java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> params)
          Sends a HTTP POST request
 HTTPResponse fireHttpPutRequest(java.lang.String uri)
          Sends a HTTP PUT request
 HTTPResponse fireHttpPutRequest(java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> params)
          Sends a HTTP PUT request
 HTTPResponse fireHttpRequest(java.lang.String method, java.lang.String uri)
          Sends a HTTP request.
 HTTPResponse fireHttpRequest(java.lang.String method, java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> params)
          Sends a HTTP request with parameters.
 void shutDown()
          Shuts down the HTTP client.
 void startUp()
          Creates a HTTP client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET

public static final java.lang.String GET
See Also:
Constant Field Values

POST

public static final java.lang.String POST
See Also:
Constant Field Values

PUT

public static final java.lang.String PUT
See Also:
Constant Field Values

DELETE

public static final java.lang.String DELETE
See Also:
Constant Field Values

HEAD

public static final java.lang.String HEAD
See Also:
Constant Field Values

OPTIONS

public static final java.lang.String OPTIONS
See Also:
Constant Field Values
Constructor Detail

HTTPClient

public HTTPClient()
Method Detail

startUp

public void startUp()
Creates a HTTP client.


shutDown

public void shutDown()
Shuts down the HTTP client.


fireHttpGetRequest

public HTTPResponse fireHttpGetRequest(java.lang.String uri)
Sends a HTTP GET request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpPostRequest

public HTTPResponse fireHttpPostRequest(java.lang.String uri)
Sends a HTTP POST request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpPostRequest

public HTTPResponse fireHttpPostRequest(java.lang.String uri,
                                        java.util.Map<java.lang.String,java.lang.String> params)
Sends a HTTP POST request

Parameters:
uri - the request uri
params - parameters to send with the request
Returns:
an HTTPResponse instance

fireHttpPutRequest

public HTTPResponse fireHttpPutRequest(java.lang.String uri)
Sends a HTTP PUT request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpPutRequest

public HTTPResponse fireHttpPutRequest(java.lang.String uri,
                                       java.util.Map<java.lang.String,java.lang.String> params)
Sends a HTTP PUT request

Parameters:
uri - the request uri
params - parameters to send with the request
Returns:
an HTTPResponse instance

fireHttpDeleteRequest

public HTTPResponse fireHttpDeleteRequest(java.lang.String uri)
Sends a HTTP DELETE request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpHeadRequest

public HTTPResponse fireHttpHeadRequest(java.lang.String uri)
Sends a HTTP HEAD request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpOptionsRequest

public HTTPResponse fireHttpOptionsRequest(java.lang.String uri)
Sends a HTTP OPTIONS request

Parameters:
uri - the request uri
Returns:
an HTTPResponse instance

fireHttpRequest

public HTTPResponse fireHttpRequest(java.lang.String method,
                                    java.lang.String uri)
Sends a HTTP request.

Parameters:
method - a HTTP method
uri - request uri
Returns:
an HTTPResponse instance

fireHttpRequest

public HTTPResponse fireHttpRequest(java.lang.String method,
                                    java.lang.String uri,
                                    java.util.Map<java.lang.String,java.lang.String> params)
Sends a HTTP request with parameters. Please note that the params parameter is only useful for requests using POST and PUT method.

Parameters:
method - a HTTP method
uri - request uri
params - request parameters
Returns:
an HTTPResponse instance