de.fzj.unicore.wsrflite.xfire.http
Class HttpUtils

java.lang.Object
  extended by de.fzj.unicore.wsrflite.xfire.http.HttpUtils

public class HttpUtils
extends Object

contains helper code to create HttpClient instances and configuring SSL on a per site basis Contains some code from XFire's CommonsHttpMessageSender

Author:
schuller

Field Summary
static String DISABLE_EXPECT_CONTINUE
           
static String DISABLE_KEEP_ALIVE
           
static String GZIP_ENABLED
          Enable GZIP on request and response.
static String GZIP_REQUEST_ENABLED
          GZIP the requests.
static String GZIP_RESPONSE_ENABLED
          Request GZIP encoded responses.
static String HTTP_CLIENT
           
static String HTTP_CLIENT_PARAMS
           
static String HTTP_CONNECT_TIMEOUT
          timeout for creating new HTTP connections
static String HTTP_NON_PROXY_HOSTS
           
static String HTTP_PROXY_HOST
          HTTP proxy host
static String HTTP_PROXY_PASS
          HTTP proxy password
static String HTTP_PROXY_PORT
          HTTP proxy port
static String HTTP_PROXY_USER
          HTTP proxy user name
static String HTTP_STATE
           
static String HTTP_TIMEOUT
          socket read timeout for HTTP
static String MAX_CONN_PER_HOST
           
static String MAX_TOTAL_CONNECTIONS
           
static String USER_AGENT
           
 
Method Summary
static void configureProxy(org.apache.commons.httpclient.HttpClient client, String uri)
          configure the proxy settings (taken from Kernel/System properties) on the given client
static org.apache.commons.httpclient.HttpClient createClient()
          create a HTTP client (code is based on XFire's CommonsHttpMessageSender
static org.apache.commons.httpclient.HttpClient createClient(String uri, ISecurityProperties security)
          Convenience method for getting a pre-configured HttpClient
static org.apache.commons.httpclient.HostConfiguration getHostConfiguration(ISecurityProperties sec)
          get a HostConfiguration using the specified security settings
static void setConnectionTimeout(org.apache.commons.httpclient.HttpClient client, int timeout)
          set the connection timeout for the HTTP client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISABLE_KEEP_ALIVE

public static final String DISABLE_KEEP_ALIVE
See Also:
Constant Field Values

DISABLE_EXPECT_CONTINUE

public static final String DISABLE_EXPECT_CONTINUE
See Also:
Constant Field Values

HTTP_CLIENT_PARAMS

public static final String HTTP_CLIENT_PARAMS
See Also:
Constant Field Values

USER_AGENT

public static final String USER_AGENT
See Also:
Constant Field Values

HTTP_NON_PROXY_HOSTS

public static final String HTTP_NON_PROXY_HOSTS
See Also:
Constant Field Values

HTTP_PROXY_HOST

public static final String HTTP_PROXY_HOST
HTTP proxy host

See Also:
Constant Field Values

HTTP_PROXY_PORT

public static final String HTTP_PROXY_PORT
HTTP proxy port

See Also:
Constant Field Values

HTTP_PROXY_USER

public static final String HTTP_PROXY_USER
HTTP proxy user name

See Also:
Constant Field Values

HTTP_PROXY_PASS

public static final String HTTP_PROXY_PASS
HTTP proxy password

See Also:
Constant Field Values

HTTP_STATE

public static final String HTTP_STATE
See Also:
Constant Field Values

HTTP_CLIENT

public static final String HTTP_CLIENT
See Also:
Constant Field Values

HTTP_TIMEOUT

public static final String HTTP_TIMEOUT
socket read timeout for HTTP

See Also:
Constant Field Values

HTTP_CONNECT_TIMEOUT

public static final String HTTP_CONNECT_TIMEOUT
timeout for creating new HTTP connections

See Also:
Constant Field Values

GZIP_ENABLED

public static final String GZIP_ENABLED
Enable GZIP on request and response.

See Also:
Constant Field Values

GZIP_RESPONSE_ENABLED

public static final String GZIP_RESPONSE_ENABLED
Request GZIP encoded responses.

See Also:
Constant Field Values

GZIP_REQUEST_ENABLED

public static final String GZIP_REQUEST_ENABLED
GZIP the requests.

See Also:
Constant Field Values

MAX_CONN_PER_HOST

public static final String MAX_CONN_PER_HOST
See Also:
Constant Field Values

MAX_TOTAL_CONNECTIONS

public static final String MAX_TOTAL_CONNECTIONS
See Also:
Constant Field Values
Method Detail

createClient

public static org.apache.commons.httpclient.HttpClient createClient(String uri,
                                                                    ISecurityProperties security)
Convenience method for getting a pre-configured HttpClient

Parameters:
uri - - URI to connect to
security - - security (i.e. SSL) properties
Returns:
a preconfigured http client

createClient

public static org.apache.commons.httpclient.HttpClient createClient()
create a HTTP client (code is based on XFire's CommonsHttpMessageSender


configureProxy

public static void configureProxy(org.apache.commons.httpclient.HttpClient client,
                                  String uri)
configure the proxy settings (taken from Kernel/System properties) on the given client

Parameters:
client - - the HttpClient instance
uri - - the URI to connect to

getHostConfiguration

public static org.apache.commons.httpclient.HostConfiguration getHostConfiguration(ISecurityProperties sec)
get a HostConfiguration using the specified security settings

Parameters:
sec - - security (SSL) settings
Returns:
HostConfiguration

setConnectionTimeout

public static void setConnectionTimeout(org.apache.commons.httpclient.HttpClient client,
                                        int timeout)
set the connection timeout for the HTTP client

Parameters:
client - - the HTTPClient
timeout - - timout in millis


Copyright © 2010. All Rights Reserved.