Class ClientSessionConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
ClientSession
will use an instance of this class as its connection.- Author:
- Gaston Dombiak
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.Connection
Connection.ClientAuth, Connection.CompressionPolicy, Connection.State, Connection.TLSPolicy
-
Field Summary
Fields inherited from class org.jivesoftware.openfire.net.AbstractConnection
closeListeners, session
-
Constructor Summary
ConstructorsConstructorDescriptionClientSessionConnection
(String connectionManagerName, String hostName, String hostAddress) -
Method Summary
Modifier and TypeMethodDescriptionvoid
closeVirtualConnection
(org.xmpp.packet.StreamError error) If the Connection Manager or the Client requested to close the connection then just do nothing.void
deliver
(org.xmpp.packet.Packet packet) Delivers the packet to the Connection Manager that in turn will forward it to the target user.void
deliverRawText
(String text) Delivers the stanza to the Connection Manager that in turn will forward it to the target user.byte[]
Returns the raw IP address of thisInetAddress
object.Returns the TLS cipher suite name used by the connection of the session, if any.Returns a representation of the desired state for this connection.Returns the IP address string in textual presentation.Gets the host name for this IP address.Returns the TLS protocol name used by the connection of the session, if any.void
Notification message indicating that the server is being shutdown.Methods inherited from class org.jivesoftware.openfire.net.VirtualConnection
addCompression, close, getLocalCertificates, getPacketDeliverer, getPeerCertificates, isClosed, isCompressed, isEncrypted, isInitialized, isUsingSelfSignedCertificate, setUsingSelfSignedCertificate, startCompression, startTLS, validate
Methods inherited from class org.jivesoftware.openfire.net.AbstractConnection
getAdditionalNamespaces, getMajorXMPPVersion, getMinorXMPPVersion, getSession, init, notifyCloseListeners, registerCloseListener, reinit, removeCloseListener, setAdditionalNamespaces, setXMPPVersion
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jivesoftware.openfire.Connection
close, close
-
Constructor Details
-
ClientSessionConnection
-
-
Method Details
-
deliver
public void deliver(org.xmpp.packet.Packet packet) Delivers the packet to the Connection Manager that in turn will forward it to the target user. Connection Managers may have one or many connections to the server so just get any connection to the Connection Manager (uses a random) and use it.If the packet to send does not have a TO attribute then wrap the packet with a special IQ packet. The wrapper IQ packet will be sent to the Connection Manager and the stream ID of this Client Session will be used for identifying that the wrapped packet must be sent to the connected user. Since some packets can be exchanged before the user has a bound JID we need to use the stream ID as the unique identifier.
- Parameters:
packet
- the packet to send to the user.
-
deliverRawText
Delivers the stanza to the Connection Manager that in turn will forward it to the target user. Connection Managers may have one or many connections to the server so just get any connection to the Connection Manager (uses a random) and use it.The stanza to send wrapped with a special IQ packet. The wrapper IQ packet will be sent to the Connection Manager and the stream ID of this Client Session will be used for identifying that the wrapped stanza must be sent to the connected user.
- Parameters:
text
- the stanza to send to the user.
-
getTLSProtocolName
Description copied from interface:Connection
Returns the TLS protocol name used by the connection of the session, if any.- Returns:
- a TLS protocol (version) name.
-
getCipherSuiteName
Description copied from interface:Connection
Returns the TLS cipher suite name used by the connection of the session, if any.- Returns:
- cipher suite name.
-
getConfiguration
Description copied from interface:Connection
Returns a representation of the desired state for this connection. Note that this is different from the current state of the connection. For example, TLS can be required by configuration, but while the connection has yet to be fully initialized, the current state might not be TLS-encrypted.- Returns:
- The desired configuration for the connection (never null).
-
getAddress
Description copied from interface:Connection
Returns the raw IP address of thisInetAddress
object. The result is in network byte order: the highest order byte of the address is ingetAddress()[0]
.- Returns:
- the raw IP address of this object.
- Throws:
UnknownHostException
- if IP address of host could not be determined.
-
getHostAddress
Description copied from interface:Connection
Returns the IP address string in textual presentation.- Returns:
- the raw IP address in a string format.
- Throws:
UnknownHostException
- if IP address of host could not be determined.
-
getHostName
Description copied from interface:Connection
Gets the host name for this IP address.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.- Returns:
- the host name for this IP address, or if the operation is not allowed by the security check, the textual representation of the IP address.
- Throws:
UnknownHostException
- if IP address of host could not be determined.- See Also:
-
systemShutdown
public void systemShutdown()Description copied from interface:Connection
Notification message indicating that the server is being shutdown. Implementors should send a stream error whose condition is system-shutdown before closing the connection. -
closeVirtualConnection
public void closeVirtualConnection(@Nullable org.xmpp.packet.StreamError error) If the Connection Manager or the Client requested to close the connection then just do nothing. But if the server originated the request to close the connection then we need to send to the Connection Manager a packet letting him know that the Client Session needs to be terminated.- Specified by:
closeVirtualConnection
in classVirtualConnection
- Parameters:
error
- If non-null, this error will be sent to the peer before the connection is disconnected.
-