|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.Helper
org.restlet.engine.RestletHelper<T>
org.restlet.engine.ConnectorHelper<T>
org.restlet.engine.http.connector.BaseHelper<Client>
org.restlet.engine.http.connector.BaseClientHelper
public class BaseClientHelper
Base client helper based on NIO blocking sockets. Here is the list of parameters that are supported. They should be set in the Client's context before it is started:
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 Summary | |
---|---|
BaseClientHelper(Client connector)
Constructor. |
Method Summary | |
---|---|
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. |
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. |
Methods inherited from class org.restlet.engine.ConnectorHelper |
---|
getConnectorService, getContext, getProtocols, update |
Methods inherited from class org.restlet.engine.RestletHelper |
---|
getAttributes, getHelped, getHelpedParameters, getLogger, getMetadataService, setHelped |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseClientHelper(Client connector)
connector
- The helped client connector.Method Detail |
---|
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 request
java.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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |