php.java.servlet
Class Context

java.lang.Object
  extended by php.java.bridge.http.Context
      extended by php.java.servlet.Context
All Implemented Interfaces:
IContext, Invocable
Direct Known Subclasses:
RemoteContext

public class Context
extends Context

A custom context which keeps the HttpServletResponse. Used when JSR223 is not available.

Author:
jostb

Field Summary
static int APPLICATION_SCOPE
          Integer value for the level of APPLICATION_SCOPE
static int REQUEST_SCOPE
          Integer value for the level of SCRIPT_SCOPE
static int SESSION_SCOPE
          Integer value for the level of SESSION_SCOPE
 
Fields inherited from interface php.java.bridge.http.IContext
ENGINE_SCOPE, GLOBAL_SCOPE, JAVA_BRIDGE, SERVLET, SERVLET_CONFIG, SERVLET_CONTEXT, SERVLET_REQUEST, SERVLET_RESPONSE
 
Constructor Summary
Context(javax.servlet.ServletContext kontext, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Create a new context.
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.
 java.lang.Object getAttribute(java.lang.String key, int scope)
          Retrieves the value associated with specified name in the specified level of scope.
 java.lang.Object getHttpServletRequest()
          Use java_context()->getAttribute(...) instead
 java.lang.Object getHttpServletResponse()
          Use java_context()->getAttribute(...) instead
 java.lang.Object getServlet()
          Use java_context()->getAttribute(...) instead
 java.lang.Object getServletConfig()
          Use java_context()->getAttribute(...) instead
 java.lang.Object getServletContext()
          Use java_context()->getAttribute(...) instead
 java.io.Writer getWriter()
          Retrieves an instance of java.io.Writer which can be used by scripts to display their output.
 
Methods inherited from class php.java.bridge.http.Context
call, getAttributesScope, removeAttribute, setAttribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_SCOPE

public static final int REQUEST_SCOPE
Integer value for the level of SCRIPT_SCOPE

See Also:
Constant Field Values

SESSION_SCOPE

public static final int SESSION_SCOPE
Integer value for the level of SESSION_SCOPE

See Also:
Constant Field Values

APPLICATION_SCOPE

public static final int APPLICATION_SCOPE
Integer value for the level of APPLICATION_SCOPE

See Also:
Constant Field Values
Constructor Detail

Context

public Context(javax.servlet.ServletContext kontext,
               javax.servlet.http.HttpServletRequest req,
               javax.servlet.http.HttpServletResponse res)
Create a new context.

Parameters:
res - The HttpServletResponse
Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.String key,
                                     int scope)
Description copied from interface: IContext
Retrieves the value associated with specified name in the specified level of scope. Returns null if no value is associated with specified key in specified level of scope.

Specified by:
getAttribute in interface IContext
Overrides:
getAttribute in class Context
Parameters:
key - the name of the attribute
scope - the level of scope
Returns:
the value value associated with the specified name in specified level of scope

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Description copied from interface: IContext
Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.

Specified by:
getAttribute in interface IContext
Overrides:
getAttribute in class Context
Parameters:
name - the name of the attribute
Returns:
the value of the attribute
Throws:
java.lang.IllegalArgumentException

getWriter

public java.io.Writer getWriter()
                         throws java.io.IOException
Description copied from interface: IContext
Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

Specified by:
getWriter in interface IContext
Overrides:
getWriter in class Context
Returns:
an instance of java.io.Writer
Throws:
java.io.IOException

getHttpServletResponse

public java.lang.Object getHttpServletResponse()
Use java_context()->getAttribute(...) instead

Overrides:
getHttpServletResponse in class Context

getHttpServletRequest

public java.lang.Object getHttpServletRequest()
Use java_context()->getAttribute(...) instead

Overrides:
getHttpServletRequest in class Context

getServlet

public java.lang.Object getServlet()
Use java_context()->getAttribute(...) instead


getServletConfig

public java.lang.Object getServletConfig()
Use java_context()->getAttribute(...) instead


getServletContext

public java.lang.Object getServletContext()
Use java_context()->getAttribute(...) instead

Overrides:
getServletContext in class Context