Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.coherence.servlet
Interface HttpSessionModel

All Known Implementing Classes:
  AbstractHttpSessionModel, MonolithicHttpSessionModel, SplitHttpSessionModel, TraditionalHttpSessionModel

    public interface HttpSessionModel

This is the abstract model for HttpSession implementations that support clustering.

The model contains the following properties:

- String Id
- long CreationTime
- long LastAccessedTime
- int MaxInactiveInterval
- boolean New
- boolean Valid
- Attribute[] {Name, Value}

This interface is intended to be a logical terminal.

Version:
  Coherence 2.3
Author:
  cp 2003.07.28

Method Summary
`java.lang.Object` | `getAttribute(java.lang.String sName)` Returns the object bound with the specified name in this session, or `null` if no object is bound under the name.
`java.lang.String[]` | `getAttributeNameArray()` Returns an array of attribute names for this session.
`long` | `getCreationTime()` Returns the creation time for this session.
`java.lang.String` | `getId()` Returns the session identifier for this session.
`long` | `getLastAccessedTime()` Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT.
`int` | `getMaxInactiveInterval()` Returns the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
`boolean` | `isExpired()` A helper method to determine if the session data has expired.
`boolean` | `isNew()` Returns `true` if the client does not yet know about the session or if the client chooses not to join the session.
`boolean` | `isUsable()` Determine if this session model is a usable object.
`boolean` | `isValid()` Determine if this session model is valid.
`void` | `removeAttribute(java.lang.String sName)` Removes the object bound with the specified name from this session.
`void` | `sessionReturned()` Indicates to the session that it is no longer new, because the session ID has been returned to the client to allow the client to accept it, as described in the Servlet specification.
`void` | `setAttribute(java.lang.String sName, java.lang.Object oValue)` Binds an object to this session, using the name specified.
`void` | `setMaxInactiveInterval(int cSeconds)` Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
`void` | `touch()` Update the last-accessed time for the session.

Method Detail

### getAttribute

    java.lang.Object getAttribute(java.lang.String sName)

  Returns the object bound with the specified name in this session, or `null` if no object is bound under the name.

  Parameters:
    `sName` - a string specifying the name of the object
  Returns:
    the object with the specified name
  Throws:
    `java.lang.IllegalStateException` - if this method is called on an invalidated session

### getAttributeNameArray

    java.lang.String[] getAttributeNameArray()

  Returns an array of attribute names for this session.

  Returns:
    an array of `String` objects specifying the names of all the objects bound to this session
  Throws:
    `java.lang.IllegalStateException` - if this method is called on an invalidated session

### getCreationTime

    long getCreationTime()

  Returns the creation time for this session.

  Returns:
    the creation time for this session

### getId

    java.lang.String getId()

  Returns the session identifier for this session.

  Returns:
    the session identifier for this session.

### getLastAccessedTime

    long getLastAccessedTime()

  Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

  Returns:
    the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time

### getMaxInactiveInterval

    int getMaxInactiveInterval()

  Returns the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.

  Returns:
    the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out

### isExpired

    boolean isExpired()

  A helper method to determine if the session data has expired.

  Returns:
    true if the session served by this session model has expired

### isNew

    boolean isNew()

  Returns `true` if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.

  Returns:
    `true` if the server has created a session, but the client has not yet joined
  Throws:
    `java.lang.IllegalStateException` - if this method is called on an already invalidated session

### isUsable

    boolean isUsable()

  Determine if this session model is a usable object. For example, a session model may become unusable if it is passivated and then held beyond the request scope.

  When a session model becomes unusable, the only method that can be assumed to respond without throwing an exception is `getId()`.

  Returns:
    true if this session model object is still usable, false if the session model should be re-obtained from its collection

### isValid

    boolean isValid()

  Determine if this session model is valid.

  Returns:
    `true` if the session has not been destroyed, otherwise `false`

### removeAttribute

    void removeAttribute(java.lang.String sName)

  Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

  Parameters:
    `sName` - the name of the object to remove from this session
  Throws:
    `java.lang.IllegalStateException` - if this method is called on an invalidated session

### sessionReturned

    void sessionReturned()

  Indicates to the session that it is no longer new, because the session ID has been returned to the client to allow the client to accept it, as described in the Servlet specification.

### setAttribute

    void setAttribute(java.lang.String sName,
                      java.lang.Object oValue)

  Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

  Parameters:
    `sName` - the name to which the object is bound; cannot be null
    `oValue` - the object to be bound; cannot be null
  Throws:
    `java.lang.IllegalStateException` - if this method is called on an invalidated session

### setMaxInactiveInterval

    void setMaxInactiveInterval(int cSeconds)

  Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.

  Parameters:
    `cSeconds` - the new maximum interval

### touch

    void touch()

  Update the last-accessed time for the session.

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.