## php.java.bridge.http
Class SimpleContextFactory

    java.lang.Object
      php.java.bridge.http.SimpleContextFactory

All Implemented Interfaces:
  IContextFactory, IContextFactoryVisitor

Direct Known Subclasses:
  PhpScriptContextFactory, ServletContextFactory

    public class SimpleContextFactory

extends java.lang.Object
implements IContextFactoryVisitor

Base of a set of visitors which can extend the standard ContextFactory.

See Also:
  `ServletContextFactory`, `PhpScriptContextFactory`, `PhpFacesScriptContextFactory`

Method Summary
`void` `destroy()` Removes the context factory from the classloader's list of context factories and destroys its content.
`JavaBridge` `getBridge()` Return the JavaBridge.
`java.lang.Object` `getContext()` Return a JSR223 context
`java.lang.String` `getId()` Return the serializable ID of the context manager
`ISession` `getSession(java.lang.String name, boolean clientIsNew, int timeout)`
`void` `recycle(ContextFactory visited)` Typically this method should attach the fresh ContextFactory to the target.
`void` `recycle(java.lang.String id)` Synchronize the current state with id.
`void` `remove()` Removes the context factory from the classloader's list of context factories.
`void` `setBridge(JavaBridge bridge)` Set the JavaBridge into this context.
`void` `setContext(java.lang.Object context)` Set the Context into this factory.
`java.lang.String` `toString()`
`void` `visit(ContextFactory visited)` Called when a visitor has been attached.
`void` `waitFor()` Wait until this context is finished.

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

Method Detail

### recycle

    public void recycle(java.lang.String id)
                 throws java.lang.SecurityException

  Description copied from interface: `IContextFactory`
  Synchronize the current state with id.

  When persistent connections are used, the bridge instances recycle their context factories. However, a jsr223 client may have passed a fresh context id. If this happened, the bridge calls this method which may update the current context with the fresh values from id.

  This method automatically destroys the fresh context id

  Specified by:
    `recycle` in interface `IContextFactory`
  Parameters:
    `id` - The fresh id
  Throws:
    `java.lang.SecurityException`
  See Also:
    `JavaBridge.recycle()`

### destroy

    public void destroy()

  Description copied from interface: `IContextFactory`
  Removes the context factory from the classloader's list of context factories and destroys its content.

  Specified by:
    `destroy` in interface `IContextFactory`
  See Also:
    `IContextFactory.remove()`

### waitFor

    public void waitFor()
                 throws java.lang.InterruptedException

  Description copied from interface: `IContextFactory`
  Wait until this context is finished.

  Specified by:
    `waitFor` in interface `IContextFactory`
  Throws:
    `java.lang.InterruptedException`
  See Also:
    `ContextRunner`

### getId

    public java.lang.String getId()

  Description copied from interface: `IContextFactory`
  Return the serializable ID of the context manager

  Specified by:
    `getId` in interface `IContextFactory`
  Returns:
    The ID

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getContext

    public java.lang.Object getContext()

  Description copied from interface: `IContextFactory`
  Return a JSR223 context

  Specified by:
    `getContext` in interface `IContextFactory`
  Returns:
    The context
  See Also:
    `getContext()`, `Context`

### setBridge

    public void setBridge(JavaBridge bridge)

  Description copied from interface: `IContextFactory`
  Set the JavaBridge into this context.

  Specified by:
    `setBridge` in interface `IContextFactory`
  Parameters:
    `bridge` - The bridge to set.

### getBridge

    public JavaBridge getBridge()

  Description copied from interface: `IContextFactory`
  Return the JavaBridge.

  Specified by:
    `getBridge` in interface `IContextFactory`
  Returns:
    Returns the bridge.

### visit

    public void visit(ContextFactory visited)

  Description copied from interface: `IContextFactoryVisitor`
  Called when a visitor has been attached.

  Specified by:
    `visit` in interface `IContextFactoryVisitor`
  Parameters:
    `visited` - The context factory

### getSession

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

  Specified by:
    `getSession` in interface `IContextFactory`
  Parameters:
    `name` - The session name. If name is null, the name PHPSESSION will be used.
    `clientIsNew` - true if the client wants a new session
    `timeout` - timeout in seconds. If 0 the session does not expire.
  Returns:
    The session
  See Also:
    `ISession`

### setContext

    public void setContext(java.lang.Object context)

  Description copied from interface: `IContextFactory`
  Set the Context into this factory. Should be called by Context.addNew() only.

  Specified by:
    `setContext` in interface `IContextFactory`
  See Also:
    `ContextFactory.addNew()`

### recycle

    public void recycle(ContextFactory visited)

  Description copied from interface: `IContextFactory`
  Typically this method should attach the fresh ContextFactory to the target.

  Specified by:
    `recycle` in interface `IContextFactory`
  Parameters:
    `visited` - The persistent ContextFactory.
  See Also:
    `ContextFactory.accept(IContextFactoryVisitor)`, `IContextFactoryVisitor.visit(ContextFactory)`

### remove

    public void remove()

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

  Specified by:
    `remove` in interface `IContextFactory`