## org.red5.server.net.remoting
Class RemotingClient

    java.lang.Object
      org.red5.server.net.remoting.RemotingClient

All Implemented Interfaces:
  InitializingBean

Direct Known Subclasses:
  DSRemotingClient

    public class RemotingClient

extends Object
implements InitializingBean

Client interface for remoting calls.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de), Paul Gregoire (mondain@gmail.com)

Nested Class Summary
`static class` `RemotingClient.RemotingWorker` Worker class that is used for asynchronous remoting calls.

Field Summary
`protected String` `appendToUrl` Additional string to use while connecting.
`protected org.apache.commons.httpclient.HttpClient` `client` HTTP client for remoting calls.
`protected static org.apache.commons.httpclient.HttpConnectionManager` `connectionMgr` Manages HTTP connections.
`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 Logger` `log` Logger
`protected int` `poolSize` Maximum pool threads
`protected String` `url` Url to connect to.

Constructor Summary
`RemotingClient()` Dummy constructor used by the spring configuration.
`RemotingClient(String url)` Create new remoting client for the given url.
`RemotingClient(String url, org.apache.commons.httpclient.HttpConnectionManager mgr)` Create new remoting client in the given connection manager.
`RemotingClient(String url, int timeout)` Create new remoting client for the given url and given timeout.
`RemotingClient(String url, int timeout, org.apache.commons.httpclient.HttpConnectionManager mgr)` Create new remoting client with the given connection manager and timeout.

Method Summary
`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)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Logger log

  Logger

### DEFAULT_TIMEOUT

    public static final int DEFAULT_TIMEOUT

  Default timeout to use.

  See Also:
    Constant Field Values

### CONTENT_TYPE

    protected static final String CONTENT_TYPE

  Content MIME type for HTTP requests.

  See Also:
    Constant Field Values

### connectionMgr

    protected static org.apache.commons.httpclient.HttpConnectionManager connectionMgr

  Manages HTTP connections.

### client

    protected org.apache.commons.httpclient.HttpClient client

  HTTP client for remoting calls.

### url

    protected String url

  Url to connect to.

### appendToUrl

    protected String appendToUrl

  Additional string to use while connecting.

### headers

    protected Map<String,RemotingHeader> headers

  Headers to send to the server.

### executor

    protected static ExecutorService executor

  Thread pool to use for asynchronous requests.

### poolSize

    protected int poolSize

  Maximum pool threads

Constructor Detail

### RemotingClient

    public RemotingClient()

  Dummy constructor used by the spring configuration.

### RemotingClient

    public RemotingClient(String url)

  Create new remoting client for the given url.

  Parameters:
    `url` - URL to connect to

### RemotingClient

    public RemotingClient(String url,
                          int timeout)

  Create new remoting client for the given url and given timeout.

  Parameters:
    `url` - URL to connect to
    `timeout` - Timeout for one request in milliseconds

### RemotingClient

    public RemotingClient(String url,
                          org.apache.commons.httpclient.HttpConnectionManager mgr)

  Create new remoting client in the given connection manager.

  Parameters:
    `url` - URL to connect to
    `mgr` - The connection manager to use

### RemotingClient

    public RemotingClient(String url,
                          int timeout,
                          org.apache.commons.httpclient.HttpConnectionManager mgr)

  Create new remoting client with the given connection manager and timeout.

  Parameters:
    `url` - URL to connect to
    `timeout` - Timeout for one request in milliseconds
    `mgr` - The connection manager to use

Method Detail

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`
  Throws:
    `Exception`

### getPoolSize

    public int getPoolSize()

### setPoolSize

    public void setPoolSize(int poolSize)

### processHeaders

    protected void processHeaders(IoBuffer in)

  Process any headers sent in the response.

  Parameters:
    `in` - Byte buffer with response data

### setCredentials

    public void setCredentials(String userid,
                               String password)

  Send authentication data with each remoting request.

  Parameters:
    `userid` - User identifier
    `password` - Password

### resetCredentials

    public void resetCredentials()

  Stop sending authentication data.

### addHeader

    public void addHeader(String name,
                          boolean required,
                          Object value)

  Send an additional header to the server.

  Parameters:
    `name` - Header name
    `required` - Header required?
    `value` - Header body

### removeHeader

    public void removeHeader(String name)

  Stop sending a given header.

  Parameters:
    `name` - Header name

### invokeMethod

    public Object invokeMethod(String method,
                               Object[] params)

  Invoke a method synchronously on the remoting server.

  Parameters:
    `method` - Method name
    `params` - Parameters passed to method
  Returns:
    the result of the method call

### invokeMethod

    public void invokeMethod(String method,
                             Object[] methodParams,
                             IRemotingCallback callback)

  Invoke a method asynchronously on the remoting server.

  Parameters:
    `method` - Method name
    `methodParams` - Parameters passed to method
    `callback` - Callback

Copyright © 2006-2010 The Red5 Project