Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.9.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.session
Interface Session

All Superinterfaces:
  ChannelHandler, RoutableChannelHandler

All Known Subinterfaces:
  ClientSession, ComponentSession, ConnectionMultiplexerSession, IncomingServerSession, OutgoingServerSession

All Known Implementing Classes:
  HttpSession, LocalClientSession, LocalComponentSession, LocalConnectionMultiplexerSession, LocalIncomingServerSession, LocalOutgoingServerSession, LocalSession

    public interface Session

extends RoutableChannelHandler

The session represents a connection between the server and a client (c2s) or another server (s2s) as well as a connection with a component. Authentication and user accounts are associated with c2s connections while s2s has an optional authentication association but no single user user.

Obtain object managers from the session in order to access server resources.

Author:
  Gaston Dombiak

Field Summary
`static int` | `MAJOR_VERSION` Version of the XMPP spec supported as MAJOR_VERSION.MINOR_VERSION (e.g.
`static int` | `MINOR_VERSION`
`static int` | `STATUS_AUTHENTICATED`
`static int` | `STATUS_CLOSED`
`static int` | `STATUS_CONNECTED`

Method Summary
`void` | `close()` Close this session including associated socket connection.
`void` | `deliverRawText(String text)` Delivers raw text to this connection.
`org.xmpp.packet.JID` | `getAddress()` Obtain the address of the user.
`Date` | `getCreationDate()` Obtain the date the session was created.
`String` | `getHostAddress()` Returns the IP address string in textual presentation.
`String` | `getHostName()` Gets the host name for this IP address.
`Date` | `getLastActiveDate()` Obtain the time the session last had activity.
`long` | `getNumClientPackets()` Obtain the number of packets sent from the client to the server.
`long` | `getNumServerPackets()` Obtain the number of packets sent from the server to the client.
`String` | `getServerName()` Obtain the name of the server this session belongs to.
`int` | `getStatus()` Obtain the current status of this session.
`StreamID` | `getStreamID()` Obtain the stream ID associated with this sesison.
`boolean` | `isClosed()` Returns true if the connection/session is closed.
`boolean` | `isSecure()` Returns true if this connection is secure.
`void` | `process(org.xmpp.packet.Packet packet)` Process an XMPP packet.
`boolean` | `validate()` Verifies that the connection is still live.

Field Detail

### MAJOR_VERSION

    static final int MAJOR_VERSION

  Version of the XMPP spec supported as MAJOR_VERSION.MINOR_VERSION (e.g. 1.0).

  See Also:
    Constant Field Values

### MINOR_VERSION

    static final int MINOR_VERSION

See Also:
  Constant Field Values

### STATUS_CLOSED

    static final int STATUS_CLOSED

See Also:
  Constant Field Values

### STATUS_CONNECTED

    static final int STATUS_CONNECTED

See Also:
  Constant Field Values

### STATUS_AUTHENTICATED

    static final int STATUS_AUTHENTICATED

See Also:
  Constant Field Values

Method Detail

### getAddress

    org.xmpp.packet.JID getAddress()

  Obtain the address of the user. The address is used by services like the core server packet router to determine if a packet should be sent to the handler. Handlers that are working on behalf of the server should use the generic server hostname address (e.g. server.com).

  Specified by:
    `getAddress` in interface `RoutableChannelHandler`
  Returns:
    the address of the packet handler.

### getStatus

    int getStatus()

  Obtain the current status of this session.

  Returns:
    The status code for this session

### getStreamID

    StreamID getStreamID()

  Obtain the stream ID associated with this sesison. Stream ID's are generated by the server and should be unique and random.

  Returns:
    This session's assigned stream ID

### getServerName

    String getServerName()

  Obtain the name of the server this session belongs to.

  Returns:
    the server name.

### getCreationDate

    Date getCreationDate()

  Obtain the date the session was created.

  Returns:
    the session's creation date.

### getLastActiveDate

    Date getLastActiveDate()

  Obtain the time the session last had activity.

  Returns:
    The last time the session received activity.

### getNumClientPackets

    long getNumClientPackets()

  Obtain the number of packets sent from the client to the server.

  Returns:
    The number of packets sent from the client to the server.

### getNumServerPackets

    long getNumServerPackets()

  Obtain the number of packets sent from the server to the client.

  Returns:
    The number of packets sent from the server to the client.

### close

    void close()

  Close this session including associated socket connection. The order of events for closing the session is:
  - Set closing flag to prevent redundant shutdowns.
  - Call notifyEvent all listeners that the channel is shutting down.
  - Close the socket.

### isClosed

    boolean isClosed()

  Returns true if the connection/session is closed.

  Returns:
    true if the connection is closed.

### isSecure

    boolean isSecure()

  Returns true if this connection is secure.

  Returns:
    true if the connection is secure (e.g. SSL/TLS)

### getHostAddress

    String getHostAddress()
                          throws UnknownHostException

  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

    String getHostName()
                       throws UnknownHostException

  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:
    `InetAddress.getCanonicalHostName()`, `SecurityManager.checkConnect(java.lang.String, int)`

### process

    void process(org.xmpp.packet.Packet packet)

  Description copied from interface: `ChannelHandler`
  Process an XMPP packet.

  Specified by:
    `process` in interface `ChannelHandler`
  Parameters:
    `packet` - a packet to process.

### deliverRawText

    void deliverRawText(String text)

  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 using `process(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.

### validate

    boolean validate()

  Verifies that the connection is still live. Typically this is done by sending a whitespace character between packets. // TODO No one is sending this message now. Delete it?

  Returns:
    true if the socket remains valid, false otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.9.3 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.