php.java.servlet
Class SimpleServletContextFactory

java.lang.Object
  extended by php.java.bridge.http.SimpleContextFactory
      extended by php.java.servlet.SimpleServletContextFactory
All Implemented Interfaces:
IContextFactory, IContextFactoryVisitor, IJavaBridgeFactory
Direct Known Subclasses:
InvocablePhpServletContextFactory, RemoteServletContextFactory, ServletContextFactory

public class SimpleServletContextFactory
extends SimpleContextFactory

Create session contexts for servlets.

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

See Also:
ContextFactory, ContextServer

Method Summary
 IContext createContext()
          Return an emulated JSR223 context.
 void destroy()
          Destroy the factory
 java.lang.String getRedirectString()
          Return the redirect string, for example h:localhost:8080/JavaBridge/test.php
 java.lang.String getRedirectString(java.lang.String webPath)
          Return the redirect string, for example h:localhost:8080/webPath
 javax.servlet.http.HttpSession getSession()
          Return the http session handle or null;
 ISession getSession(java.lang.String name, boolean clientIsNew, int timeout)
          Return a session for the JavaBridge
 java.lang.String getSocketName()
          Return the socket name, for example 8080
 
Methods inherited from class php.java.bridge.http.SimpleContextFactory
getBridge, getClassLoader, getContext, getId, getJavaBridgeClassLoader, getSession, initialize, invalidate, isNew, recycle, recycle, release, releaseManaged, setClassLoader, setContext, toString, visit, waitFor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSession

public ISession getSession(java.lang.String name,
                           boolean clientIsNew,
                           int timeout)
Return a session for the JavaBridge

Specified by:
getSession in interface IContextFactory
Specified by:
getSession in interface IJavaBridgeFactory
Overrides:
getSession in class SimpleContextFactory
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

destroy

public void destroy()
Destroy the factory

Specified by:
destroy in interface IJavaBridgeFactory
Overrides:
destroy in class SimpleContextFactory

createContext

public IContext createContext()
Return an emulated JSR223 context.

Returns:
The context.
See Also:
Context

getSession

public javax.servlet.http.HttpSession getSession()
Return the http session handle or null;

Returns:
The session handle

getRedirectString

public java.lang.String getRedirectString()
Return the redirect string, for example h:localhost:8080/JavaBridge/test.php

Specified by:
getRedirectString in interface IContextFactory
Overrides:
getRedirectString in class SimpleContextFactory
Returns:
the redirect string

getRedirectString

public java.lang.String getRedirectString(java.lang.String webPath)
Return the redirect string, for example h:localhost:8080/webPath

Specified by:
getRedirectString in interface IContextFactory
Overrides:
getRedirectString in class SimpleContextFactory
Parameters:
webPath - Usually request.getContextPath()+request.getServletPath()
Returns:
the redirect string

getSocketName

public java.lang.String getSocketName()
Return the socket name, for example 8080

Specified by:
getSocketName in interface IContextFactory
Overrides:
getSocketName in class SimpleContextFactory
Returns:
the socket name