### php.java.servlet

# Class HttpSessionFacade

- `java.lang.Object`

- `php.java.servlet.HttpSessionFacade`

Implemented Interfaces:
  ISession

`public class HttpSessionFacade`
`extends java.lang.Object`
`implements ISession`

## Constructor Summary

`HttpSessionFacade(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, int timeout)`

## Method Summary

`void`

`destroy()`
  Causes this representation of the session to be invalidated an removed from its context.

`java.lang.Object`

`get(java.lang.Object ob)`
  Returns the object bound to the given name in the session's context layer data.

`java.util.Map`

`getAll()`
  Returns a map of all bindings maintained by this session.

`javax.servlet.http.HttpServletRequest`

`getHttpServletRequest()`
  Returns the HttpServletRequest

`javax.servlet.http.HttpServletResponse`

`getHttpServletResponse()`
  Returns the ServletResponse

`javax.servlet.ServletContext`

`getServletContext()`
  Returns the ServletContext

`int`

`getSessionCount()`
  Returns the number of active sessions.

`int`

`getTimeout()`
  Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.

`boolean`

`isNew()`
  A session is considered to be "new" if it has been created by the server, but the client has not yet acknowledged joining the session.

`void`

`put(java.lang.Object ob1, java.lang.Object ob2)`
  Binds the specified object into the session's context layer data with the given name.

`void`

`putAll(java.util.Map vars)`
  Copies all bindings to the session's context layer data.

`java.lang.Object`

`remove(java.lang.Object ob)`
  Removes the object bound to the given name in the session's context layer data.

`void`

`setTimeout(int timeout)`
  Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Constructor Details

### HttpSessionFacade

    public HttpSessionFacade(javax.servlet.ServletContext ctx,
                             javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse res,
                             int timeout)

## Method Details

### destroy

    public void destroy()

> Causes this representation of the session to be invalidated an removed from its context.
> Specified by:
>   destroy in interface ISession

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after the session has been invalidated

### get

    public java.lang.Object get(java.lang.Object ob)

> Returns the object bound to the given name in the session's context layer data. Returns null if there is no such binding.
> Specified by:
>   get in interface ISession

> Parameters:

> Returns:
>   the value bound to that name, or null if the binding does not exist.

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after it has been invalidated

### getAll

    public java.util.Map getAll()

> Returns a map of all bindings maintained by this session.
> Specified by:
>   getAll in interface ISession

> Returns:
>   the map

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after it has been invalidated

### getHttpServletRequest

    public javax.servlet.http.HttpServletRequest getHttpServletRequest()

> Returns the HttpServletRequest

> Returns:
>   The HttpServletRequest.

### getHttpServletResponse

    public javax.servlet.http.HttpServletResponse getHttpServletResponse()

> Returns the ServletResponse

> Returns:
>   The ServletResponse.

### getServletContext

    public javax.servlet.ServletContext getServletContext()

> Returns the ServletContext

> Returns:
>   The ServletContext.

### getSessionCount

    public int getSessionCount()

> Returns the number of active sessions.
> Specified by:
>   getSessionCount in interface ISession

> Returns:
>   # of active sessions.

### getTimeout

    public int getTimeout()

> Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the `setTimeout` method. A negative time indicates the session should never timeout.
> Specified by:
>   getTimeout in interface ISession

> Returns:
>   an integer specifying the number of seconds this session remains open between client requests

> See Also:
>   `ISession.setTimeout(int)`

### isNew

    public boolean isNew()

> A session is considered to be "new" if it has been created by the server, but the client has not yet acknowledged joining the session. For example, if the server supported only cookie-based sessions and the client had completely disabled the use of cookies, then calls to JavaBridge.getSession() would always return "new" sessions.
> Specified by:
>   isNew in interface ISession

> Returns:
>   true if the session has been created by the server but the client has not yet acknowledged joining the session; false otherwise

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after the session has been invalidated

### put

    public void put(java.lang.Object ob1,
                    java.lang.Object ob2)

> Binds the specified object into the session's context layer data with the given name. Any existing binding with the same name is replaced.
> Specified by:
>   put in interface ISession

> Parameters:

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after the session has been invalidated.

### putAll

    public void putAll(java.util.Map vars)

> Copies all bindings to the session's context layer data. Any existing binding with the same name is replaced.
> Specified by:
>   putAll in interface ISession

> Parameters:
>   `vars` - the map parameter cannot be null.

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after the session has been invalidated.

### remove

    public java.lang.Object remove(java.lang.Object ob)

> Removes the object bound to the given name in the session's context layer data. Does nothing if there is no object bound to the given name.
> Specified by:
>   remove in interface ISession

> Parameters:

> Throws:
>   `java.lang.IllegalStateException` - if an attempt is made to access session data after the session has been invalidated.

### setTimeout

    public void setTimeout(int timeout)

> Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.
> Specified by:
>   setTimeout in interface ISession

> Parameters: