Class HttpSession.HttpVirtualConnection
- java.lang.Object
-
- org.jivesoftware.openfire.net.AbstractConnection
-
- org.jivesoftware.openfire.net.VirtualConnection
-
- org.jivesoftware.openfire.http.HttpSession.HttpVirtualConnection
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
- Enclosing class:
- HttpSession
public static class HttpSession.HttpVirtualConnection extends VirtualConnection
A virtual server connection relates to a http session which its self can relate to many http connections.
-
-
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
Constructors Constructor Description HttpVirtualConnection(InetAddress address, PacketDeliverer backupDeliverer, ConnectionType connectionType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeVirtualConnection(org.xmpp.packet.StreamError error)
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 thisInetAddress
object.Optional<String>
getCipherSuiteName()
Returns the TLS cipher suite name used by the connection of the session, if any.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.X509Certificate[]
getPeerCertificates()
Returns the underlyingX509Certificate
for the connection of the peer.Optional<String>
getTLSProtocolName()
Returns the TLS protocol name used by the connection of the session, if any.void
systemShutdown()
Notification message indicating that the server is being shutdown.-
Methods inherited from class org.jivesoftware.openfire.net.VirtualConnection
addCompression, close, getLocalCertificates, isClosed, isCompressed, isEncrypted, isInitialized, isSecure, 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 Detail
-
HttpVirtualConnection
public HttpVirtualConnection(@Nonnull InetAddress address, @Nullable PacketDeliverer backupDeliverer, @Nonnull ConnectionType connectionType)
-
-
Method Detail
-
closeVirtualConnection
public void closeVirtualConnection(@Nullable org.xmpp.packet.StreamError error)
Description copied from class:VirtualConnection
Closes the virtual connection. Subclasses should indicate what closing a virtual connection means. At this point the session has a CLOSED state.- Specified by:
closeVirtualConnection
in classVirtualConnection
- Parameters:
error
- If non-null, this error will be sent to the peer before the connection is disconnected.
-
getAddress
public byte[] 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.
-
getHostAddress
public String getHostAddress()
Description copied from interface:Connection
Returns the IP address string in textual presentation.- Returns:
- the raw IP address in a string format.
-
getHostName
public String 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.
- See Also:
InetAddress.getCanonicalHostName()
,SecurityManager.checkConnect(java.lang.String, int)
-
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.
-
deliver
public void deliver(org.xmpp.packet.Packet packet)
Description copied from interface:Connection
Delivers the packet to this connection without checking the recipient. The method essentially callssocket.send(packet.getWriteBuffer())
. Use with caution! This code is unlikely to be called directly. Instead, ensure that data sent to the entities is sent through the appropriate LocalSession object. For clients, this prevents, for example, synchronisation issues with stanza counts related to Stream Management (XEP-0198).- Parameters:
packet
- the packet to deliver.
-
deliverRawText
public void deliverRawText(@Nullable String text)
Description copied from interface:Connection
Delivers raw text to this connection. This is a very low level way for sending XML stanzas to the client. This method should not be used unless you have very good reasons for not usingConnection.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.
- Parameters:
text
- the XML stanzas represented kept in a String.
-
getTLSProtocolName
public Optional<String> 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
public Optional<String> 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
public ConnectionConfiguration 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).
-
getPeerCertificates
public X509Certificate[] getPeerCertificates()
Description copied from interface:Connection
Returns the underlyingX509Certificate
for the connection of the peer.- Specified by:
getPeerCertificates
in interfaceConnection
- Overrides:
getPeerCertificates
in classVirtualConnection
- Returns:
- an ordered array of peer certificates, with the peer's own certificate first followed by any certificate authorities.
-
getPacketDeliverer
@Nullable public PacketDeliverer getPacketDeliverer()
Description copied from interface:Connection
Returns the packet deliverer to use when delivering a packet over the socket fails. The packet deliverer will retry to send the packet using some other connection or will store the packet offline for later retrieval. When null, packets will just be dropped.- Specified by:
getPacketDeliverer
in interfaceConnection
- Overrides:
getPacketDeliverer
in classVirtualConnection
- Returns:
- the packet deliverer to use when delivering a packet over the socket fails.
-
-