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 class
Worker class that is used for asynchronous remoting calls. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Additional string to use while connecting.protected org.apache.http.client.HttpClient
HTTP client for remoting calls.protected static final String
Content MIME type for HTTP requests.static final int
Default timeout to use.protected static ExecutorService
Thread pool to use for asynchronous requests.protected Map
<String, RemotingHeader> Headers to send to the server.protected static org.slf4j.Logger
Constantlog
protected int
Maximum pool threadsprotected String
Url 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 TypeMethodDescriptionvoid
Send an additional header to the server.int
Getter for the fieldpoolSize
.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
(org.apache.mina.core.buffer.IoBuffer in) Process any headers sent in the response.void
removeHeader
(String name) Stop sending a given header.void
Stop sending authentication data.void
setCredentials
(String userid, String password) Send authentication data with each remoting request.void
setPoolSize
(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:
invokeMethod
in 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
-