public class RemotingClient extends Object implements org.springframework.beans.factory.InitializingBean
Modifier and Type | Class and Description |
---|---|
static class |
RemotingClient.RemotingWorker
Worker class that is used for asynchronous remoting calls.
|
Modifier and Type | Field and Description |
---|---|
protected String |
appendToUrl
Additional string to use while connecting.
|
protected org.apache.http.impl.client.DefaultHttpClient |
client
HTTP client for remoting calls.
|
protected static String |
CONTENT_TYPE
Content MIME type for HTTP requests.
|
static int |
DEFAULT_TIMEOUT
Default timeout to use.
|
protected static ExecutorService |
executor
Thread pool to use for asynchronous requests.
|
protected Map<String,RemotingHeader> |
headers
Headers to send to the server.
|
protected static org.slf4j.Logger |
log |
protected int |
poolSize
Maximum pool threads
|
protected String |
url
Url to connect to.
|
Constructor and Description |
---|
RemotingClient()
Dummy constructor used by the spring configuration.
|
RemotingClient(String url)
Create new remoting client for the given url.
|
RemotingClient(String url,
int timeout)
Create new remoting client for the given url and given timeout.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
boolean required,
Object value)
Send an additional header to the server.
|
void |
afterPropertiesSet() |
int |
getPoolSize() |
Object |
invokeMethod(String method,
Object[] params)
Invoke a method synchronously on the remoting server.
|
void |
invokeMethod(String method,
Object[] methodParams,
IRemotingCallback callback)
Invoke a method asynchronously on the remoting server.
|
protected void |
processHeaders(IoBuffer in)
Process any headers sent in the response.
|
void |
removeHeader(String name)
Stop sending a given header.
|
void |
resetCredentials()
Stop sending authentication data.
|
void |
setCredentials(String userid,
String password)
Send authentication data with each remoting request.
|
void |
setPoolSize(int poolSize) |
protected static org.slf4j.Logger log
public static final int DEFAULT_TIMEOUT
protected static final String CONTENT_TYPE
protected org.apache.http.impl.client.DefaultHttpClient client
protected String url
protected String appendToUrl
protected Map<String,RemotingHeader> headers
protected static ExecutorService executor
protected int poolSize
public RemotingClient()
public RemotingClient(String url)
url
- URL to connect topublic RemotingClient(String url, int timeout)
url
- URL to connect totimeout
- Timeout for one request in millisecondspublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public int getPoolSize()
public void setPoolSize(int poolSize)
protected void processHeaders(IoBuffer in)
in
- Byte buffer with response datapublic void setCredentials(String userid, String password)
userid
- User identifierpassword
- Passwordpublic void resetCredentials()
public void addHeader(String name, boolean required, Object value)
name
- Header namerequired
- Header required?value
- Header bodypublic void removeHeader(String name)
name
- Header namepublic Object invokeMethod(String method, Object[] params)
method
- Method nameparams
- Parameters passed to methodpublic void invokeMethod(String method, Object[] methodParams, IRemotingCallback callback)
method
- Method namemethodParams
- Parameters passed to methodcallback
- CallbackCopyright © 2006-2012 The Red5 Project