Package org.red5.server.net.remoting
Class RemotingClient
java.lang.Object
org.red5.server.net.remoting.RemotingClient
- All Implemented Interfaces:
IRemotingClient
- Direct Known Subclasses:
DSRemotingClient
Client interface for remoting calls.
- Author:
- The Red5 Project, Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWorker class that is used for asynchronous remoting calls. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringAdditional string to use while connecting.protected org.apache.http.client.HttpClientHTTP client for remoting calls.protected static final StringContent MIME type for HTTP requests.static final intDefault timeout to use.protected static ExecutorServiceThread pool to use for asynchronous requests.protected Map<String, RemotingHeader> Headers to send to the server.protected static org.slf4j.LoggerConstantlogprotected intMaximum pool threadsprotected StringUrl to connect to. -
Constructor Summary
ConstructorsConstructorDescriptionDummy 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. -
Method Summary
Modifier and TypeMethodDescriptionvoidSend an additional header to the server.intGetter for the fieldpoolSize.invokeMethod(String method, Object[] params) Invoke a method synchronously on the remoting server.voidinvokeMethod(String method, Object[] methodParams, IRemotingCallback callback) Invoke a method asynchronously on the remoting server.protected voidprocessHeaders(org.apache.mina.core.buffer.IoBuffer in) Process any headers sent in the response.voidremoveHeader(String name) Stop sending a given header.voidStop sending authentication data.voidsetCredentials(String userid, String password) Send authentication data with each remoting request.voidsetPoolSize(int poolSize) Setter for the fieldpoolSize.
-
Field Details
-
log
protected static org.slf4j.Logger logConstantlog -
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTDefault timeout to use.- See Also:
-
CONTENT_TYPE
Content MIME type for HTTP requests.- See Also:
-
client
protected org.apache.http.client.HttpClient clientHTTP client for remoting calls. -
url
Url to connect to. -
appendToUrl
Additional string to use while connecting. -
headers
Headers to send to the server. -
executor
Thread pool to use for asynchronous requests. -
poolSize
protected int poolSizeMaximum pool threads
-
-
Constructor Details
-
RemotingClient
public RemotingClient()Dummy constructor used by the spring configuration. -
RemotingClient
Create new remoting client for the given url.- Parameters:
url- URL to connect to
-
RemotingClient
Create new remoting client for the given url and given timeout.- Parameters:
url- URL to connect totimeout- Timeout for one request in milliseconds
-
-
Method Details
-
getPoolSize
public int getPoolSize()Getter for the field
poolSize.- Returns:
- a int
-
setPoolSize
public void setPoolSize(int poolSize) Setter for the field
poolSize.- Parameters:
poolSize- a int
-
processHeaders
protected void processHeaders(org.apache.mina.core.buffer.IoBuffer in) Process any headers sent in the response.- Parameters:
in- Byte buffer with response data
-
setCredentials
Send authentication data with each remoting request.- Parameters:
userid- User identifierpassword- Password
-
resetCredentials
public void resetCredentials()Stop sending authentication data. -
addHeader
Send an additional header to the server.- Parameters:
name- Header namerequired- Header required?value- Header body
-
removeHeader
Stop sending a given header.- Parameters:
name- Header name
-
invokeMethod
Invoke a method synchronously on the remoting server.- Specified by:
invokeMethodin interfaceIRemotingClient- Parameters:
method- Method nameparams- Parameters passed to method- Returns:
- the result of the method call
-
invokeMethod
Invoke a method asynchronously on the remoting server.- Parameters:
method- Method namemethodParams- Parameters passed to methodcallback- Callback
-