public class BaseClientHelper extends BaseHelper<Client>
Parameter name | Value type | Default value | Description |
---|---|---|---|
proxyHost | String | System property "http.proxyHost" | The host name of the HTTP proxy. |
proxyPort | int | System property "http.proxyPort" | The port of the HTTP proxy. |
tcpNoDelay | boolean | false | Indicate if Nagle's TCP_NODELAY algorithm should be used. | keystorePath | String | ${user.home}/.keystore | SSL keystore path. |
keystorePassword | String | System property "javax.net.ssl.keyStorePassword" | SSL keystore password. |
keystoreType | String | JKS | SSL keystore type |
keyPassword | String | System property "javax.net.ssl.keyStorePassword" | SSL key password. |
certAlgorithm | String | SunX509 | SSL certificate algorithm. |
secureRandomAlgorithm | String | null (see java.security.SecureRandom) | Name of the RNG algorithm. (see java.security.SecureRandom class). |
securityProvider | String | null (see javax.net.ssl.SSLContext) | Java security provider name (see java.security.Provider class). |
sslProtocol | String | TLS | SSL protocol. |
truststoreType | String | System property "javax.net.ssl.trustStoreType" | Trust store type |
truststorePath | String | null | Path to trust store |
truststorePassword | String | System property "javax.net.ssl.trustStorePassword" | Trust store password |
Constructor and Description |
---|
BaseClientHelper(Client connector)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Connection<Client> |
createConnection(BaseHelper<Client> helper,
java.net.Socket socket,
java.nio.channels.SocketChannel socketChannel)
Creates a connection associated to the given socket.
|
protected javax.net.SocketFactory |
createSecureSocketFactory()
Creates a properly configured secure socket factory.
|
protected java.net.Socket |
createSocket(boolean secure,
java.net.InetSocketAddress socketAddress)
Creates the socket that will be used to send the request and get the
response.
|
protected java.net.Socket |
createSocket(boolean secure,
java.lang.String hostDomain,
int hostPort)
Creates the socket that will be used to send the request and get the
response.
|
protected javax.net.SocketFactory |
createSocketFactory(boolean secure)
Creates a normal or secure socket factory.
|
protected Connection<Client> |
getBestConnection(Request request)
Tries to reuse an existing connection for the given request, or creates a
new one.
|
java.lang.String |
getCertAlgorithm()
Returns the SSL certificate algorithm.
|
int |
getConnectTimeout()
Returns the connection timeout.
|
java.lang.String |
getKeyPassword()
Returns the SSL key password.
|
java.lang.String |
getKeystorePassword()
Returns the SSL keystore password.
|
java.lang.String |
getKeystorePath()
Returns the SSL keystore path.
|
java.lang.String |
getKeystoreType()
Returns the SSL keystore type.
|
java.lang.String |
getProxyHost()
Returns the host name of the HTTP proxy, if specified.
|
int |
getProxyPort()
Returns the port of the HTTP proxy, if specified, 3128 otherwise.
|
javax.net.SocketFactory |
getRegularSocketFactory()
Returns the regular socket factory.
|
java.lang.String |
getSecureRandomAlgorithm()
Returns the name of the RNG algorithm.
|
javax.net.SocketFactory |
getSecureSocketFactory()
Returns the secure socket factory.
|
java.lang.String |
getSecurityProvider()
Returns the Java security provider name.
|
protected java.net.InetSocketAddress |
getSocketAddress(Request request)
Returns an IP socket address representing the target host domain and port
for a given request.
|
javax.net.SocketFactory |
getSocketFactory(boolean secure)
Returns the socket factory.
|
java.lang.String |
getSslProtocol()
Returns the SSL keystore type.
|
boolean |
getTcpNoDelay()
Indicates if the protocol will use Nagle's algorithm
|
java.lang.String |
getTruststorePassword()
Returns the SSL trust store password.
|
java.lang.String |
getTruststorePath()
Returns the SSL trust store path.
|
java.lang.String |
getTruststoreType()
Returns the SSL trust store type.
|
void |
handle(Request request,
Response response)
Handles a call.
|
void |
handleInbound(Response response)
Handles an inbound message.
|
void |
handleOutbound(Response response)
Handles an outbound message.
|
boolean |
isProxying()
Indicates if the helper is going through a client proxy or is a server
proxy.
|
void |
setRegularSocketFactory(javax.net.SocketFactory regularSocketFactory)
Sets the regular socket factory.
|
void |
setSecureSocketFactory(javax.net.SocketFactory secureSocketFactory)
Sets the secure socket factory.
|
void |
start()
Start callback.
|
void |
stop()
Stop callback.
|
createController, createControllerService, createResponse, createWorkerService, getConnections, getController, getControllerSleepTimeMs, getInboundBufferSize, getInboundMessages, getMaxConnectionsPerHost, getMaxThreads, getMaxTotalConnections, getMinThreads, getOutboundBufferSize, getOutboundMessages, getThreadMaxIdleTimeMs, getWorkerService, handleNextInbound, handleNextOutbound, isClientSide, isControllerDaemon, isPersistingConnections, isPipeliningConnections, isServerSide, isTracing, isWorkerServiceFull
getConnectorService, getContext, getProtocols, update
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped
public BaseClientHelper(Client connector)
connector
- The helped client connector.protected Connection<Client> createConnection(BaseHelper<Client> helper, java.net.Socket socket, java.nio.channels.SocketChannel socketChannel) throws java.io.IOException
BaseHelper
createConnection
in class BaseHelper<Client>
helper
- The parent helper.socket
- The underlying BIO socket.socketChannel
- The underlying NIO socket channel.java.io.IOException
protected javax.net.SocketFactory createSecureSocketFactory() throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
protected java.net.Socket createSocket(boolean secure, java.net.InetSocketAddress socketAddress) throws java.net.UnknownHostException, java.io.IOException
getBestConnection(Request)
when a new connection is to be created. By default, calls the
createSocket(boolean, String, int)
method.secure
- Indicates if messages will be exchanged confidentially, for
example via a SSL-secured connection.socketAddress
- The holder of a host/port pair.java.net.UnknownHostException
java.io.IOException
protected java.net.Socket createSocket(boolean secure, java.lang.String hostDomain, int hostPort) throws java.net.UnknownHostException, java.io.IOException
secure
- Indicates if messages will be exchanged confidentially, for
example via a SSL-secured connection.hostDomain
- The target host domain name.hostPort
- The target host port.java.net.UnknownHostException
java.io.IOException
protected javax.net.SocketFactory createSocketFactory(boolean secure)
secure
- Indicates if the sockets should be secured.protected Connection<Client> getBestConnection(Request request) throws java.net.UnknownHostException, java.io.IOException
request
- The request to handle.java.net.UnknownHostException
java.io.IOException
public java.lang.String getCertAlgorithm()
public int getConnectTimeout()
public java.lang.String getKeyPassword()
public java.lang.String getKeystorePassword()
public java.lang.String getKeystorePath()
public java.lang.String getKeystoreType()
public java.lang.String getProxyHost()
public int getProxyPort()
public javax.net.SocketFactory getRegularSocketFactory()
public java.lang.String getSecureRandomAlgorithm()
public javax.net.SocketFactory getSecureSocketFactory()
public java.lang.String getSecurityProvider()
protected java.net.InetSocketAddress getSocketAddress(Request request) throws java.net.UnknownHostException
getBestConnection(Request)
method.request
- The given requestjava.net.UnknownHostException
- If the proxy port is invalid or the host unresolved.public javax.net.SocketFactory getSocketFactory(boolean secure)
secure
- Indicates if a factory for secure sockets is expected.public java.lang.String getSslProtocol()
public boolean getTcpNoDelay()
Socket.setTcpNoDelay(boolean)
public java.lang.String getTruststorePassword()
public java.lang.String getTruststorePath()
public java.lang.String getTruststoreType()
public void handle(Request request, Response response)
RestletHelper
handle
in class RestletHelper<Client>
request
- The request to handle.response
- The response to update.public void handleInbound(Response response)
BaseHelper
handleInbound
in class BaseHelper<Client>
response
- The response to handle.public void handleOutbound(Response response)
BaseHelper
handleOutbound
in class BaseHelper<Client>
response
- The response to handle.public void setRegularSocketFactory(javax.net.SocketFactory regularSocketFactory)
regularSocketFactory
- The regular socket factory.public void setSecureSocketFactory(javax.net.SocketFactory secureSocketFactory)
secureSocketFactory
- The secure socket factory.public void start() throws java.lang.Exception
RestletHelper
start
in class BaseHelper<Client>
java.lang.Exception
public void stop() throws java.lang.Exception
RestletHelper
stop
in class BaseHelper<Client>
java.lang.Exception
public boolean isProxying()
BaseHelper
isProxying
in class BaseHelper<Client>
Copyright © 2005-2012. All Rights Reserved.