## php.java.servlet
Class ContextFactory

    java.lang.Object
      php.java.bridge.SessionFactory
          php.java.bridge.http.ContextFactory
              php.java.servlet.ContextFactory

Direct Known Subclasses:
  PhpFacesScriptContextFactory

    public class ContextFactory

extends ContextFactory

Create session contexts for servlets.

In addition to the standard ContextFactory this manager keeps a reference to the HttpServletRequest.

See Also:
  `ContextFactory`, `ContextServer`

Method Summary
`static ContextFactory` `addNew(javax.servlet.ServletContext kontext, javax.servlet.http.HttpServletRequest proxy, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)` Create and add a new ContextFactory.
`ISession` `getSession(java.lang.String name, boolean clientIsNew, int timeout)`
`void` `remove()` Removes the context factory from the classloader's list of context factories.
`void` `setSession(javax.servlet.http.HttpServletRequest req)` Set the HttpServletRequest for session sharing.
`java.lang.String` `toString()`

Methods inherited from class php.java.bridge.http.ContextFactory
`addNew, get, getBridge, getContext, getId, removeAll, setBridge, waitFor`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### setSession

    public void setSession(javax.servlet.http.HttpServletRequest req)

  Set the HttpServletRequest for session sharing.

  Parameters:
    `req` - The HttpServletRequest
  Throws:
    `java.lang.IllegalStateException` - When the ContextFactory was created with a HttpServletRequest or when this method was called twice.

### getSession

    public ISession getSession(java.lang.String name,
                               boolean clientIsNew,
                               int timeout)

  Overrides:
    `getSession` in class `SessionFactory`
  Parameters:
    `name` - The session name. If name is null, the session is an internal session
    `clientIsNew` - true if the client wants a new session
    `timeout` - timeout in seconds. If 0 the session does not expire.

### addNew

    public static ContextFactory addNew(javax.servlet.ServletContext kontext,
                                        javax.servlet.http.HttpServletRequest proxy,
                                        javax.servlet.http.HttpServletRequest req,
                                        javax.servlet.http.HttpServletResponse res)

  Create and add a new ContextFactory.

  Parameters:
    `req` - The HttpServletRequest
    `res` - The HttpServletResponse
  Returns:
    The created ContextFactory

### remove

    public void remove()

  Description copied from class: `ContextFactory`
  Removes the context factory from the classloader's list of context factories.

  Overrides:
    `remove` in class `ContextFactory`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `ContextFactory`