org.apache.servicemix.http
Class HttpConfiguration

java.lang.Object
  extended by org.apache.servicemix.http.HttpConfiguration
All Implemented Interfaces:
HttpConfigurationMBean

public class HttpConfiguration
extends java.lang.Object
implements HttpConfigurationMBean

Class to hold the configuration for the Jetty instance used by an HTTP endpoint.

Author:
gnodet

Field Summary
static java.lang.String CONFIG_FILE
           
static java.lang.String DEFAULT_JETTY_CONNECTOR_CLASS_NAME
           
static java.lang.String MAPPING_DEFAULT
           
 
Constructor Summary
HttpConfiguration()
           
 
Method Summary
 java.lang.Object getAuthenticationService()
          Gets the authentication service being used.
 java.lang.String getAuthenticationServiceName()
          Gets the JNDI name of the authentication service object.
 int getClientSoTimeout()
          Gets the number of milliseconds for soTimeout parameter of JettyClient when JettyClient instance is shared among http:provider enpoints.
 java.lang.String getComponentName()
           
 int getConnectorMaxIdleTime()
          Gets the amount of time, in milliseconds, that a connection will sit idle before timing out.
 int getConsumerProcessorSuspendTime()
          Gets the number of milliseconds passed to the susspend method of the Jetty Continuation object used to process requests.
 int getJettyClientThreadPoolSize()
          Get the maximum number of threads in the client-side thread pool.
 java.lang.String getJettyConnectorClassName()
          Returns the name of the class implementing the Jetty connector used by an HTTP endpoint.
 int getJettyThreadPoolSize()
          Gets the number of maximum number of threads in the server-side threadpool.
 java.lang.Object getKeystoreManager()
          Gets the object used as the keystore manager.
 java.lang.String getKeystoreManagerName()
          Gets the JNDI name of the keystore manager object.
 java.lang.String getMapping()
           
 int getMaxConnectionsPerAddress()
          Gets the number of the maximum connections per address that JettyClient creates for each destination.
 int getMaxConnectionsPerHost()
          Gets the maximum number of concurent requests allowed from a particular host.
 int getMaxTotalConnections()
          Gets the maximum number of concurent connections allowed to an endpoint.
 int getProviderExpirationTime()
          Gets the number of milliseconds that the provider will wait for a response before expiring.
 java.lang.String getProxyHost()
           
 int getProxyPort()
           
 int getRetryCount()
          Gets the number of times a request will be tried before an error is created.
 java.lang.String getRootDir()
           
 int getSoLingerTime()
          Gets the amount of connector soLingerTime, in milliseconds.
 boolean isJettyClientPerProvider()
          Determines if each HTTP provider endpoint uses its own Jetty client.
 boolean isJettyManagement()
           
 boolean isManaged()
           
 boolean isPreemptiveAuthentication()
           
 boolean isStreamingEnabled()
          Determines if client-side requests use HTTP streaming.
 boolean isUseHostPortForAuthScope()
           
 boolean isWantHeadersFromHttpIntoExchange()
          Determines if the HTTP provider processor copies the HTTP headers from the HTTP response into the JBI exchange.
 boolean load()
           
 void save()
           
 void setAuthenticationService(java.lang.Object authenticationService)
          Directly sets the authenitcation service object to be used for authentication.
 void setAuthenticationServiceName(java.lang.String authenticationServiceName)
          Sets the JNDI name of the authentication service object.
 void setClientSoTimeout(int clientSoTimeout)
          Sets the number of milliseconds for soTimeout parameter of JettyClient when JettyClient instance is shared among http:provider enpoints.
 void setComponentName(java.lang.String componentName)
           
 void setConnectorMaxIdleTime(int connectorMaxIdleTime)
          Sets the amount of time, in milliseconds, that a connection will sit idle before timing out.
 void setConsumerProcessorSuspendTime(int consumerProcessorSuspendTime)
          Sets the number of milliseconds passed to the susspend method of the Jetty Continuation object used to process requests.
 void setJettyClientPerProvider(boolean jettyClientPerProvider)
          Specifies whether each HTTP provider endpoint uses its own Jetty client.
 void setJettyClientThreadPoolSize(int jettyClientThreadPoolSize)
          Sets the maximum number of threads in the client-side thread pool.
 void setJettyConnectorClassName(java.lang.String jettyConnectorClassName)
          Sets the classname of the Jetty connector used by an HTTP endpoint.
 void setJettyManagement(boolean jettyManagement)
           
 void setJettyThreadPoolSize(int jettyThreadPoolSize)
          Sets the maximum number of threads in the server-side thread pool.
 void setKeystoreManager(java.lang.Object keystoreManager)
          Directly sets the keystore manager object to be used for authentication.
 void setKeystoreManagerName(java.lang.String keystoreManagerName)
          Sets the JNDI name of the keystore manager object.
 void setManaged(boolean managed)
           
 void setMapping(java.lang.String mapping)
           
 void setMaxConnectionsPerAddress(int maxConnectionsPerAddress)
          Sets the number of the maximum connections per address that JettyClient creates for each destination.
 void setMaxConnectionsPerHost(int maxConnectionsPerHost)
          Sets the maximum number of connections allowed from a particular host.
 void setMaxTotalConnections(int maxTotalConnections)
          Sets the maximum number of total concurrent connections allowed to an endpoint.
 void setPreemptiveAuthentication(boolean preemptiveAuthentication)
          Specifies of the httpclient uses preemptive authentication which can save performance.
protected  void setProperty(java.lang.String name, java.lang.String value)
           
 void setProviderExpirationTime(int providerExpirationTime)
          Sets the number of milliseconds the provider will wait for a response (read timeout).
 void setProxyHost(java.lang.String proxyHost)
           
 void setProxyPort(int proxyPort)
           
 void setRetryCount(int retryCount)
          Sets the number of times a request will be tried before an error is created.
 void setRootDir(java.lang.String rootDir)
           
 void setSoLingerTime(int soLingerTime)
          Sets the amount of connector soLinger time, in milliseconds.
 void setStreamingEnabled(boolean streamingEnabled)
          Sets whether or not client-side requests use HTTP streaming.
 void setUseHostPortForAuthScope(boolean useHostPortForAuthScope)
           
 void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange)
          Specifies if the HTTP provider processor copies the HTTP headers from the HTTP response into the JBI exchange.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JETTY_CONNECTOR_CLASS_NAME

public static final java.lang.String DEFAULT_JETTY_CONNECTOR_CLASS_NAME

MAPPING_DEFAULT

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

CONFIG_FILE

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

HttpConfiguration

public HttpConfiguration()
Method Detail

getRootDir

public java.lang.String getRootDir()
Returns:
Returns the rootDir.

setRootDir

public void setRootDir(java.lang.String rootDir)
Parameters:
rootDir - The rootDir to set.

getComponentName

public java.lang.String getComponentName()
Returns:
Returns the componentName.

setComponentName

public void setComponentName(java.lang.String componentName)
Parameters:
componentName - The componentName to set.

getMapping

public java.lang.String getMapping()
Returns:
the mapping

setMapping

public void setMapping(java.lang.String mapping)
Parameters:
mapping - the mapping to set

isManaged

public boolean isManaged()
Returns:
the managed

setManaged

public void setManaged(boolean managed)
Parameters:
managed - the managed to set

isJettyManagement

public boolean isJettyManagement()
Specified by:
isJettyManagement in interface HttpConfigurationMBean
Returns:
the jettyManagement

setJettyManagement

public void setJettyManagement(boolean jettyManagement)
Specified by:
setJettyManagement in interface HttpConfigurationMBean
Parameters:
jettyManagement - the jettyManagement to set

getAuthenticationService

public java.lang.Object getAuthenticationService()
Gets the authentication service being used.

Returns:
the authenticationService object

setAuthenticationService

public void setAuthenticationService(java.lang.Object authenticationService)
Directly sets the authenitcation service object to be used for authentication. This object takes precedence over the JNDI name specified by setAuthenticationServiceName.

Parameters:
authenticationService - the authenticationService object

getAuthenticationServiceName

public java.lang.String getAuthenticationServiceName()
Gets the JNDI name of the authentication service object.

Specified by:
getAuthenticationServiceName in interface HttpConfigurationMBean
Returns:
a string representing the JNDI name for the authentication service object.

setAuthenticationServiceName

public void setAuthenticationServiceName(java.lang.String authenticationServiceName)
Sets the JNDI name of the authentication service object.

Specified by:
setAuthenticationServiceName in interface HttpConfigurationMBean
Parameters:
authenticationServiceName - a string representing the JNDI name for the authentication service object.

getKeystoreManager

public java.lang.Object getKeystoreManager()
Gets the object used as the keystore manager.

Returns:
the keystoreManager object

setKeystoreManager

public void setKeystoreManager(java.lang.Object keystoreManager)
Directly sets the keystore manager object to be used for authentication. This object takes precedence over the JNDI name specified by setKeystoreManagerName.

Parameters:
keystoreManager - the keystoreManager object

getKeystoreManagerName

public java.lang.String getKeystoreManagerName()
Gets the JNDI name of the keystore manager object.

Specified by:
getKeystoreManagerName in interface HttpConfigurationMBean
Returns:
a string representing the JNDI name for the keystore manager object.

setKeystoreManagerName

public void setKeystoreManagerName(java.lang.String keystoreManagerName)
Sets the JNDI name of the keystore manager object.

Specified by:
setKeystoreManagerName in interface HttpConfigurationMBean
Parameters:
keystoreManagerName - a string representing the JNDI name for the keystore manager object.

isStreamingEnabled

public boolean isStreamingEnabled()
Determines if client-side requests use HTTP streaming.

Specified by:
isStreamingEnabled in interface HttpConfigurationMBean
Returns:
true if client-side requests use streaming

setStreamingEnabled

public void setStreamingEnabled(boolean streamingEnabled)
Sets whether or not client-side requests use HTTP streaming.

Specified by:
setStreamingEnabled in interface HttpConfigurationMBean
Parameters:
streamingEnabled - Set to true to enable client-side HTTP streaming.

getJettyConnectorClassName

public java.lang.String getJettyConnectorClassName()
Returns the name of the class implementing the Jetty connector used by an HTTP endpoint.

Specified by:
getJettyConnectorClassName in interface HttpConfigurationMBean
Returns:
a string representing the classname of the Jetty conector being used

setJettyConnectorClassName

public void setJettyConnectorClassName(java.lang.String jettyConnectorClassName)
Sets the classname of the Jetty connector used by an HTTP endpoint.

Specified by:
setJettyConnectorClassName in interface HttpConfigurationMBean
Parameters:
jettyConnectorClassName - a String representing the classname of the Jetty connector to use.

getJettyThreadPoolSize

public int getJettyThreadPoolSize()
Gets the number of maximum number of threads in the server-side threadpool.

Specified by:
getJettyThreadPoolSize in interface HttpConfigurationMBean
Returns:
an integer representing the maximum number of threads in the server-side threadpool

setJettyThreadPoolSize

public void setJettyThreadPoolSize(int jettyThreadPoolSize)
Sets the maximum number of threads in the server-side thread pool. The default is 255 to match Jetty's default setting.

Specified by:
setJettyThreadPoolSize in interface HttpConfigurationMBean
Parameters:
jettyThreadPoolSize - an integer representing the maximum number of threads in the server-side thread pool

getJettyClientThreadPoolSize

public int getJettyClientThreadPoolSize()
Get the maximum number of threads in the client-side thread pool.

Specified by:
getJettyClientThreadPoolSize in interface HttpConfigurationMBean
Returns:
an int representing the maximum number of threads in the client-side thread pool.

setJettyClientThreadPoolSize

public void setJettyClientThreadPoolSize(int jettyClientThreadPoolSize)
Sets the maximum number of threads in the client-side thread pool.

Specified by:
setJettyClientThreadPoolSize in interface HttpConfigurationMBean
Parameters:
jettyClientThreadPoolSize - an int specifiying the maximum number of threads available in the client-side thread pool

isJettyClientPerProvider

public boolean isJettyClientPerProvider()
Determines if each HTTP provider endpoint uses its own Jetty client. The default is for all HTTP provider endpoints to use a shared Jetty client.

Specified by:
isJettyClientPerProvider in interface HttpConfigurationMBean
Returns:
true if HTTP providers use individual Jetty clients

setJettyClientPerProvider

public void setJettyClientPerProvider(boolean jettyClientPerProvider)
Specifies whether each HTTP provider endpoint uses its own Jetty client. The default behavior is that all HTTP provider endpoints use a shrared Jetty client.

Specified by:
setJettyClientPerProvider in interface HttpConfigurationMBean
Parameters:
jettyClientPerProvider - true if HTTP providers are to use individual Jetty clients

getMaxConnectionsPerHost

public int getMaxConnectionsPerHost()
Gets the maximum number of concurent requests allowed from a particular host.

Specified by:
getMaxConnectionsPerHost in interface HttpConfigurationMBean
Returns:
an int representing the maximum number of connections

setMaxConnectionsPerHost

public void setMaxConnectionsPerHost(int maxConnectionsPerHost)
Sets the maximum number of connections allowed from a particular host. The default is 65536.

Specified by:
setMaxConnectionsPerHost in interface HttpConfigurationMBean
Parameters:
maxConnectionsPerHost - an int specifying the max number of connecitons

getMaxTotalConnections

public int getMaxTotalConnections()
Gets the maximum number of concurent connections allowed to an endpoint.

Specified by:
getMaxTotalConnections in interface HttpConfigurationMBean
Returns:
an int representing the total number of allowed concurrent connections

setMaxTotalConnections

public void setMaxTotalConnections(int maxTotalConnections)
Sets the maximum number of total concurrent connections allowed to an endpoint.

Specified by:
setMaxTotalConnections in interface HttpConfigurationMBean
Parameters:
maxTotalConnections - an int specifying the total number of concurrent connections allowed to an endpoint

getConnectorMaxIdleTime

public int getConnectorMaxIdleTime()
Gets the amount of time, in milliseconds, that a connection will sit idle before timing out.

Specified by:
getConnectorMaxIdleTime in interface HttpConfigurationMBean
Returns:
an int representing the number of milliseconds before an idle connection will timeout

setConnectorMaxIdleTime

public void setConnectorMaxIdleTime(int connectorMaxIdleTime)
Sets the amount of time, in milliseconds, that a connection will sit idle before timing out. The default is 30000.

Specified by:
setConnectorMaxIdleTime in interface HttpConfigurationMBean
Parameters:
connectorMaxIdleTime - an int specifying the number of milliseconds that a connection will sit idle before timing out

getSoLingerTime

public int getSoLingerTime()
Gets the amount of connector soLingerTime, in milliseconds.

Specified by:
getSoLingerTime in interface HttpConfigurationMBean
Returns:
an int representing the connector soLingerTime in milliseconds

setSoLingerTime

public void setSoLingerTime(int soLingerTime)
Sets the amount of connector soLinger time, in milliseconds. The default is -1 which means disable it.

Specified by:
setSoLingerTime in interface HttpConfigurationMBean
Parameters:
soLingerTime - an int specifying the connector soLingerTime in milliseconds

getConsumerProcessorSuspendTime

public int getConsumerProcessorSuspendTime()
Gets the number of milliseconds passed to the susspend method of the Jetty Continuation object used to process requests.

Specified by:
getConsumerProcessorSuspendTime in interface HttpConfigurationMBean
Returns:
an int representing the number of milliseconds the Jetty Continuation object will susspend the processing of the current request

setConsumerProcessorSuspendTime

public void setConsumerProcessorSuspendTime(int consumerProcessorSuspendTime)
Sets the number of milliseconds passed to the susspend method of the Jetty Continuation object used to process requests. The Continuation object is used to optimize connection resources when the endpoint is under heavy load. The default is 60000.

Specified by:
setConsumerProcessorSuspendTime in interface HttpConfigurationMBean
Parameters:
consumerProcessorSuspendTime - an int representing the number of milliseconds the Jetty Continuation object will susspend the processing of the current request

getProviderExpirationTime

public int getProviderExpirationTime()
Gets the number of milliseconds that the provider will wait for a response before expiring.

Specified by:
getProviderExpirationTime in interface HttpConfigurationMBean
Returns:
an int representing the ammout of time the provider will wait for a response before expiring.

setProviderExpirationTime

public void setProviderExpirationTime(int providerExpirationTime)
Sets the number of milliseconds the provider will wait for a response (read timeout). The default default value for Jetty is 300000.

Specified by:
setProviderExpirationTime in interface HttpConfigurationMBean
Parameters:
providerExpirationTime - an int representing the number of milliseconds the Jetty will wait for a response (read timeout).

getClientSoTimeout

public int getClientSoTimeout()
Gets the number of milliseconds for soTimeout parameter of JettyClient when JettyClient instance is shared among http:provider enpoints.

Returns:
an int representing the JettyClient soTimeout.

setClientSoTimeout

public void setClientSoTimeout(int clientSoTimeout)
Sets the number of milliseconds for soTimeout parameter of JettyClient when JettyClient instance is shared among http:provider enpoints. The default default value for Jetty is 10000.

Parameters:
clientSoTimeout - an int representing the JettyClient soTimeout.

getMaxConnectionsPerAddress

public int getMaxConnectionsPerAddress()
Gets the number of the maximum connections per address that JettyClient creates for each destination.

Returns:
an int representing the JettyClient maxConnectionsPerAddress.

setMaxConnectionsPerAddress

public void setMaxConnectionsPerAddress(int maxConnectionsPerAddress)
Sets the number of the maximum connections per address that JettyClient creates for each destination. The default default value for Jetty is 32.

Parameters:
maxConnectionsPerAddress - the maxConnectionsPerAddress to set

getRetryCount

public int getRetryCount()
Gets the number of times a request will be tried before an error is created.

Specified by:
getRetryCount in interface HttpConfigurationMBean
Returns:
an int representing the number of times a request will be attempted before an error is raised

setRetryCount

public void setRetryCount(int retryCount)
Sets the number of times a request will be tried before an error is created. The default is 3. If streaming is enabled, the value will always be 0.

Specified by:
setRetryCount in interface HttpConfigurationMBean
Parameters:
retryCount - an int representing the number of times a request will be attempted before an error is raised

getProxyHost

public java.lang.String getProxyHost()
Specified by:
getProxyHost in interface HttpConfigurationMBean
Returns:
Returns the proxyHost.

setProxyHost

public void setProxyHost(java.lang.String proxyHost)
Specified by:
setProxyHost in interface HttpConfigurationMBean
Parameters:
proxyHost - The proxyHost to set.

getProxyPort

public int getProxyPort()
Specified by:
getProxyPort in interface HttpConfigurationMBean
Returns:
Returns the proxyPort.

setProxyPort

public void setProxyPort(int proxyPort)
Specified by:
setProxyPort in interface HttpConfigurationMBean
Parameters:
proxyPort - The proxyPort to set.

isWantHeadersFromHttpIntoExchange

public boolean isWantHeadersFromHttpIntoExchange()
Determines if the HTTP provider processor copies the HTTP headers from the HTTP response into the JBI exchange.

Specified by:
isWantHeadersFromHttpIntoExchange in interface HttpConfigurationMBean
Returns:
true if the HTTP headers will be copied into the exchange

setWantHeadersFromHttpIntoExchange

public void setWantHeadersFromHttpIntoExchange(boolean wantHeadersFromHttpIntoExchange)
Specifies if the HTTP provider processor copies the HTTP headers from the HTTP response into the JBI exchange. If the headers will be used for a new HTTP reuquest, setting this to true leads to an error.

Specified by:
setWantHeadersFromHttpIntoExchange in interface HttpConfigurationMBean
Parameters:
wantHeadersFromHttpIntoExchange - true if the HTTP headers will be copied into the exchange

isPreemptiveAuthentication

public boolean isPreemptiveAuthentication()
Returns:
true if preemptive auth is used in the http client

setPreemptiveAuthentication

public void setPreemptiveAuthentication(boolean preemptiveAuthentication)
Specifies of the httpclient uses preemptive authentication which can save performance. The default is false. If enabled it always send credentials also if it is not needed.

Parameters:
preemptiveAuthentication - the value which strategy should be used

isUseHostPortForAuthScope

public boolean isUseHostPortForAuthScope()
Returns:
true if AuthScope of httpclient depeneds on host and port

setUseHostPortForAuthScope

public void setUseHostPortForAuthScope(boolean useHostPortForAuthScope)
Parameters:
useHostPortForAuthScope - If true the AuthScope of the httpclient is bind to a special host and port from the url. The default is false

save

public void save()

setProperty

protected void setProperty(java.lang.String name,
                           java.lang.String value)

load

public boolean load()


Copyright © 2005-2012 FuseSource. All Rights Reserved.