|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.red5.server.net.remoting.RemotingConnection
public class RemotingConnection
Connection class so the Red5 object works in methods invoked through remoting. Attributes are stored in the session of the implementing servlet container.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.red5.server.api.IConnection |
|---|
IConnection.Encoding |
| Field Summary | |
|---|---|
protected List<IRemotingHeader> |
headers
Headers to be returned to the client. |
protected RemotingPacket |
packet
Remoting packet that triggered the connection. |
protected javax.servlet.http.HttpServletRequest |
request
Servlet request |
protected IScope |
scope
Scope |
protected javax.servlet.http.HttpSession |
session
Session used to store properties. |
| Fields inherited from interface org.red5.server.api.IConnection |
|---|
PERSISTENT, POLLING, TRANSIENT |
| Constructor Summary | |
|---|---|
RemotingConnection(javax.servlet.http.HttpServletRequest request,
IScope scope,
RemotingPacket packet)
Create servlet connection from request and scope. |
|
| Method Summary | |
|---|---|
void |
addHeader(String name,
Object value)
Tell the client to add a header with all further requests. |
void |
addHeader(String name,
Object value,
boolean mustUnderstand)
Tell the client to add a header with all further requests. |
void |
cleanup()
Cleans up the remoting connection client from the HttpSession and client registry. |
void |
close()
Close this connection. |
boolean |
connect(IScope scope)
Try to connect to the scope. |
boolean |
connect(IScope scope,
Object[] params)
Try to connect to the scope with a list of connection parameters. |
void |
dispatchEvent(IEvent event)
Dispatches event |
void |
dispatchEvent(Object event)
|
Object |
getAttribute(String name)
Return the value for a given attribute. |
Object |
getAttribute(String name,
Object defaultValue)
Return the value for a given attribute and set it if it doesn't exist. |
Set<String> |
getAttributeNames()
Get the attribute names. |
Map<String,Object> |
getAttributes()
Get the attributes. |
Iterator<IBasicScope> |
getBasicScopes()
Get the basic scopes this connection has subscribed. |
Boolean |
getBoolAttribute(String name)
Get Boolean attribute by name |
Byte |
getByteAttribute(String name)
Get Byte attribute by name |
IClient |
getClient()
Get the client object associated with this connection. |
long |
getClientBytesRead()
Return number of written bytes the client reports to have received. |
Map<String,Object> |
getConnectParams()
Return the parameters that were given in the call to "connect". |
Double |
getDoubleAttribute(String name)
Get Double attribute by name |
long |
getDroppedMessages()
Total number of messages that have been dropped. |
IConnection.Encoding |
getEncoding()
Return encoding (AMF0 or AMF3). |
Collection<IRemotingHeader> |
getHeaders()
Return headers to send. |
String |
getHost()
Get the hostname that the client is connected to. |
Integer |
getIntAttribute(String name)
Get Integer attribute by name |
int |
getLastPingTime()
Return roundtrip time of last ping command. |
List<?> |
getListAttribute(String name)
Get List attribute by name |
Long |
getLongAttribute(String name)
Get boolean attribute by name |
Map<?,?> |
getMapAttribute(String name)
Get Long attribute by name |
String |
getPath()
Get the path for this connection. |
long |
getPendingMessages()
Total number of messages that are pending to be sent to the connection. |
long |
getPendingVideoMessages()
Return pending video messages number. |
long |
getReadBytes()
Total number of bytes read from the connection. |
long |
getReadMessages()
Total number of messages read from the connection. |
String |
getRemoteAddress()
Get the IP address the client is connected from. |
List<String> |
getRemoteAddresses()
Get the IP addresses the client is connected from. |
int |
getRemotePort()
Get the port the client is connected from. |
IScope |
getScope()
Get the scope this is connected to. |
String |
getSessionId()
Get the session id, this may be null. |
Set<?> |
getSetAttribute(String name)
Get Set attribute by name |
Short |
getShortAttribute(String name)
Get Short attribute by name |
String |
getStringAttribute(String name)
Get String attribute by name |
String |
getType()
Get the connection type. |
long |
getWrittenBytes()
Total number of bytes written to the connection. |
long |
getWrittenMessages()
Total number of messages written to the connection. |
boolean |
handleEvent(IEvent event)
Handle an event |
boolean |
hasAttribute(String name)
Check the object has an attribute. |
void |
initialize(IClient client)
Initialize the connection. |
boolean |
isConnected()
Is the client connected to the scope. |
void |
notifyEvent(IEvent event)
Notify of event. |
void |
ping()
Start measuring the roundtrip time for a packet on the connection. |
boolean |
removeAttribute(String name)
Remove an attribute. |
void |
removeAttributes()
Remove all attributes. |
void |
removeHeader(String name)
Tell the client to no longer send a header with all further requests. |
boolean |
setAttribute(String name,
Object value)
Set an attribute on this object. |
void |
setAttributes(IAttributeStore values)
Set multiple attributes on this object. |
void |
setAttributes(Map<String,Object> values)
Set multiple attributes on this object. |
protected void |
setPacket(RemotingPacket packet)
Update the current packet. |
String |
toString()
Return string representation of the connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected IScope scope
protected javax.servlet.http.HttpServletRequest request
protected RemotingPacket packet
protected javax.servlet.http.HttpSession session
protected List<IRemotingHeader> headers
| Constructor Detail |
|---|
public RemotingConnection(javax.servlet.http.HttpServletRequest request,
IScope scope,
RemotingPacket packet)
request - Servlet requestscope - Scopepacket - packet| Method Detail |
|---|
public String toString()
toString in class Objectprotected void setPacket(RemotingPacket packet)
packet - public IConnection.Encoding getEncoding()
getEncoding in interface IConnectionpublic String getType()
getType in interface ConnectionMBeangetType in interface IConnectionpublic void initialize(IClient client)
initialize in interface ConnectionMBeaninitialize in interface IConnectionclient - Client object associated with connectionpublic boolean connect(IScope scope)
connect in interface ConnectionMBeanconnect in interface IConnectionscope - Scope object
true on success, false otherwise
public boolean connect(IScope scope,
Object[] params)
connect in interface ConnectionMBeanconnect in interface IConnectionscope - Scope objectparams - Connections parameters
true on success, false otherwisepublic boolean isConnected()
true for persistent and polling connections, false for transient.
isConnected in interface ConnectionMBeanisConnected in interface IConnectiontrue if the connection is persistent or polling,
otherwise falsepublic void close()
close in interface ConnectionMBeanclose in interface IConnectionpublic Map<String,Object> getConnectParams()
getConnectParams in interface ConnectionMBeangetConnectParams in interface IConnectionpublic IClient getClient()
getClient in interface ConnectionMBeangetClient in interface IConnectionpublic String getHost()
getHost in interface ConnectionMBeangetHost in interface IConnectionpublic String getRemoteAddress()
getRemoteAddress in interface ConnectionMBeangetRemoteAddress in interface IConnectionpublic List<String> getRemoteAddresses()
getRemoteAddresses in interface ConnectionMBeangetRemoteAddresses in interface IConnectionpublic int getRemotePort()
getRemotePort in interface ConnectionMBeangetRemotePort in interface IConnectionpublic String getPath()
getPath in interface ConnectionMBeangetPath in interface IConnectionpublic String getSessionId()
null.
getSessionId in interface ConnectionMBeangetSessionId in interface IConnectionpublic long getReadBytes()
getReadBytes in interface ConnectionMBeangetReadBytes in interface IConnectionpublic long getWrittenBytes()
getWrittenBytes in interface ConnectionMBeangetWrittenBytes in interface IConnectionpublic long getPendingMessages()
getPendingMessages in interface ConnectionMBeangetPendingMessages in interface IConnectionpublic long getPendingVideoMessages()
public long getReadMessages()
getReadMessages in interface ConnectionMBeangetReadMessages in interface IConnectionpublic long getWrittenMessages()
getWrittenMessages in interface ConnectionMBeangetWrittenMessages in interface IConnectionpublic long getDroppedMessages()
getDroppedMessages in interface ConnectionMBeangetDroppedMessages in interface IConnectionpublic void ping()
ping in interface ConnectionMBeanping in interface IConnectionpublic int getLastPingTime()
getLastPingTime in interface ConnectionMBeangetLastPingTime in interface IConnectionpublic IScope getScope()
getScope in interface ConnectionMBeangetScope in interface IConnectionpublic Iterator<IBasicScope> getBasicScopes()
getBasicScopes in interface ConnectionMBeangetBasicScopes in interface IConnectionpublic void dispatchEvent(Object event)
public void dispatchEvent(IEvent event)
dispatchEvent in interface IEventDispatcherevent - Event objectpublic boolean handleEvent(IEvent event)
handleEvent in interface IEventHandlerevent - event to handle
public void notifyEvent(IEvent event)
notifyEvent in interface IEventListenerevent - the event objectpublic Boolean getBoolAttribute(String name)
getBoolAttribute in interface ICastingAttributeStorename - Attribute name
public Byte getByteAttribute(String name)
getByteAttribute in interface ICastingAttributeStorename - Attribute name
public Double getDoubleAttribute(String name)
getDoubleAttribute in interface ICastingAttributeStorename - Attribute name
public Integer getIntAttribute(String name)
getIntAttribute in interface ICastingAttributeStorename - Attribute name
public List<?> getListAttribute(String name)
getListAttribute in interface ICastingAttributeStorename - Attribute name
public Long getLongAttribute(String name)
getLongAttribute in interface ICastingAttributeStorename - Attribute name
public Map<?,?> getMapAttribute(String name)
getMapAttribute in interface ICastingAttributeStorename - Attribute name
public Set<?> getSetAttribute(String name)
getSetAttribute in interface ICastingAttributeStorename - Attribute name
public Short getShortAttribute(String name)
getShortAttribute in interface ICastingAttributeStorename - Attribute name
public String getStringAttribute(String name)
getStringAttribute in interface ICastingAttributeStorename - Attribute name
public Object getAttribute(String name)
getAttribute in interface AttributeStoreMBeangetAttribute in interface IAttributeStorename - the name of the attribute to get
public Object getAttribute(String name,
Object defaultValue)
This is a utility function that internally performs the following code:
if (!hasAttribute(name)) setAttribute(name, defaultValue);
return getAttribute(name);
getAttribute in interface AttributeStoreMBeangetAttribute in interface IAttributeStorename - the name of the attribute to getdefaultValue - the value of the attribute to set if the attribute doesn't
exist
public Set<String> getAttributeNames()
getAttributeNames in interface AttributeStoreMBeangetAttributeNames in interface IAttributeStorepublic Map<String,Object> getAttributes()
getAttributes in interface AttributeStoreMBeangetAttributes in interface IAttributeStorepublic boolean hasAttribute(String name)
hasAttribute in interface AttributeStoreMBeanhasAttribute in interface IAttributeStorename - the name of the attribute to check
public boolean removeAttribute(String name)
removeAttribute in interface AttributeStoreMBeanremoveAttribute in interface IAttributeStorename - the name of the attribute to remove
public void removeAttributes()
removeAttributes in interface AttributeStoreMBeanremoveAttributes in interface IAttributeStore
public boolean setAttribute(String name,
Object value)
setAttribute in interface AttributeStoreMBeansetAttribute in interface IAttributeStorename - the name of the attribute to changevalue - the new value of the attribute
public void setAttributes(Map<String,Object> values)
setAttributes in interface IAttributeStorevalues - the attributes to setpublic void setAttributes(IAttributeStore values)
setAttributes in interface IAttributeStorevalues - the attributes to set
public void addHeader(String name,
Object value)
addHeader in interface IRemotingConnectionname - name of the header to addvalue - value of the header to add
public void addHeader(String name,
Object value,
boolean mustUnderstand)
addHeader in interface IRemotingConnectionname - name of the header to addvalue - value of the header to addmustUnderstand - a boolean flag specifying if the server must pocess this header
before handling following headers or messagespublic void removeHeader(String name)
removeHeader in interface IRemotingConnectionname - name of the header to removepublic Collection<IRemotingHeader> getHeaders()
getHeaders in interface IRemotingConnectionpublic long getClientBytesRead()
getClientBytesRead in interface IConnectionBytesReadpublic void cleanup()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||