org.jboss.wise.lms.httpForward.service
Class HttpServiceProvider

java.lang.Object
  extended by org.jboss.wise.lms.httpForward.service.HttpServiceProvider

public class HttpServiceProvider
extends java.lang.Object

This is an utility class for actually performing HTTP connection to the target services.

Author:
Stefano Maestri, stefano.maestri@javalinux.it, Alessio Soldano, alessio.soldano@javalinux.it

Field Summary
static java.lang.String CHARSET_ENC_ISO_LATIN1
           
static java.lang.String CHARSET_ENC_UNICODE8
           
static java.lang.String DEFAULT_HTTP_PROTO_VERSION
           
static int DEFAULT_INPUT_BUFFER_SIZE
           
 
Constructor Summary
HttpServiceProvider()
           
 
Method Summary
 java.lang.String createHttpGETUrl(java.lang.String httpURLBase, java.util.Map<java.lang.String,java.lang.String> parameters)
          Creates a HTTP URL in compliance with the GET parameters encoding
 Response executeGET(Request rq)
          Performs a GET request using the provided Request data.
 Response executePOST(Request rq)
          Performs a POST request using the provided Request data.
 java.lang.String getCharset()
           
 java.lang.String getHttpProtoVersion()
           
 int getInputBufferSize()
           
 void setCharset(java.lang.String charset)
          Specifies the charset to be used when reading the response (default ISO-8859-1)
 void setHttpProtoVersion(java.lang.String httpProtoVersion)
          Sets the HTTP version to be used to perform the call (default HTTP/1.0)
 void setInputBufferSize(int inputBufferSize)
          Sets the buffer size to be used when reading the response (default 102400)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET_ENC_ISO_LATIN1

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

CHARSET_ENC_UNICODE8

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

DEFAULT_INPUT_BUFFER_SIZE

public static final int DEFAULT_INPUT_BUFFER_SIZE
See Also:
Constant Field Values

DEFAULT_HTTP_PROTO_VERSION

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

HttpServiceProvider

public HttpServiceProvider()
Method Detail

getCharset

public java.lang.String getCharset()

setCharset

public void setCharset(java.lang.String charset)
Specifies the charset to be used when reading the response (default ISO-8859-1)

Parameters:
charset -

getHttpProtoVersion

public java.lang.String getHttpProtoVersion()

setHttpProtoVersion

public void setHttpProtoVersion(java.lang.String httpProtoVersion)
Sets the HTTP version to be used to perform the call (default HTTP/1.0)

Parameters:
httpProtoVersion -

getInputBufferSize

public int getInputBufferSize()

setInputBufferSize

public void setInputBufferSize(int inputBufferSize)
Sets the buffer size to be used when reading the response (default 102400)

Parameters:
inputBufferSize -

executeGET

public Response executeGET(Request rq)
                    throws java.lang.Exception
Performs a GET request using the provided Request data.

Parameters:
rq - The request data
Returns:
A Response instance with the obtained response data.
Throws:
java.lang.Exception

executePOST

public Response executePOST(Request rq)
                     throws java.lang.Exception
Performs a POST request using the provided Request data.

Parameters:
rq - The request data
Returns:
A Response instance with the obtained response data.
Throws:
java.lang.Exception

createHttpGETUrl

public java.lang.String createHttpGETUrl(java.lang.String httpURLBase,
                                         java.util.Map<java.lang.String,java.lang.String> parameters)
                                  throws java.lang.Exception
Creates a HTTP URL in compliance with the GET parameters encoding

Parameters:
httpURLBase - The fixed part of the URL
parameters - The parameters to append to the URL
Returns:
A HTTP URL containing both the destination server address and the parameters needed to perform a GET request
Throws:
java.lang.Exception