public class WebSocketConnection extends VirtualConnection
VirtualConnection
and delegates the expected XMPP connection behaviors to the corresponding XmppWebSocket
.Connection.ClientAuth, Connection.CompressionPolicy, Connection.State, Connection.TLSPolicy
session
Constructor and Description |
---|
WebSocketConnection(XmppWebSocket socket,
InetSocketAddress remotePeer) |
Modifier and Type | Method and Description |
---|---|
void |
closeVirtualConnection()
Closes the virtual connection.
|
void |
deliver(org.xmpp.packet.Packet packet)
Delivers the packet to this connection without checking the recipient.
|
void |
deliverRawText(String text)
Delivers raw text to this connection.
|
byte[] |
getAddress()
Returns the raw IP address of this
InetAddress
object. |
ConnectionConfiguration |
getConfiguration()
Returns a representation of the desired state for this connection.
|
String |
getHostAddress()
Returns the IP address string in textual presentation.
|
String |
getHostName()
Gets the host name for this IP address.
|
PacketDeliverer |
getPacketDeliverer()
Returns the packet deliverer to use when delivering a packet over the socket fails.
|
boolean |
isCompressed()
Returns true if the connection is using compression.
|
boolean |
isSecure()
Returns true if this connection is secure.
|
void |
reinit(LocalSession session)
Reinitializes the connection to switch to a different session.
|
void |
systemShutdown()
Notification message indicating that the server is being shutdown.
|
boolean |
validate()
Verifies that the connection is still live.
|
addCompression, close, getCompressionPolicy, getLocalCertificates, getMajorXMPPVersion, getMinorXMPPVersion, getPeerCertificates, getTlsPolicy, init, isClosed, isFlashClient, isUsingSelfSignedCertificate, registerCloseListener, removeCloseListener, setCompressionPolicy, setFlashClient, setTlsPolicy, setUsingSelfSignedCertificate, setXMPPVersion, startCompression, startTLS, startTLS
public WebSocketConnection(XmppWebSocket socket, InetSocketAddress remotePeer)
public void closeVirtualConnection()
VirtualConnection
closeVirtualConnection
in class VirtualConnection
public byte[] getAddress()
Connection
InetAddress
object. The result is in network byte order: the highest order
byte of the address is in getAddress()[0]
.public String getHostAddress()
Connection
public String getHostName()
Connection
If this InetAddress was created with a host name,
this host name will be remembered and returned;
otherwise, a reverse name lookup will be performed
and the result will be returned based on the system
configured name lookup service. If a lookup of the name service
is required, call
getCanonicalHostName
.
If there is a security manager, its
checkConnect
method is first called
with the hostname and -1
as its arguments to see if the operation is allowed.
If the operation is not allowed, it will return
the textual representation of the IP address.
InetAddress.getCanonicalHostName()
,
SecurityManager.checkConnect(java.lang.String, int)
public void systemShutdown()
Connection
public void deliver(org.xmpp.packet.Packet packet) throws UnauthorizedException
Connection
socket.send(packet.getWriteBuffer())
.packet
- the packet to deliver.UnauthorizedException
- if a permission error was detected.public void deliverRawText(String text)
Connection
Connection.deliver(org.xmpp.packet.Packet)
.This method avoids having to get the writer of this connection and mess directly with the writer. Therefore, this method ensures a correct delivery of the stanza even if other threads were sending data concurrently.
text
- the XML stanzas represented kept in a String.public boolean validate()
Connection
validate
in interface Connection
validate
in class VirtualConnection
public boolean isSecure()
Connection
isSecure
in interface Connection
isSecure
in class VirtualConnection
public PacketDeliverer getPacketDeliverer()
Connection
getPacketDeliverer
in interface Connection
getPacketDeliverer
in class VirtualConnection
public ConnectionConfiguration getConfiguration()
Connection
public boolean isCompressed()
Connection
isCompressed
in interface Connection
isCompressed
in class VirtualConnection
public void reinit(LocalSession session)
Connection
reinit
in interface Connection
reinit
in class VirtualConnection
session
- The new session now owning the connection.Copyright © 2003-2008 Jive Software.