php.java.servlet
Class Context

java.lang.Object
  extended by php.java.bridge.http.Context
      extended by php.java.servlet.Context
All Implemented Interfaces:
Invocable

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 class php.java.bridge.http.Context
ENGINE_SCOPE, GLOBAL_SCOPE
 
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.
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
          Returns the HttpServletRequest
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Returns the ServletResponse
 javax.servlet.ServletContext getServletContext()
          Returns the ServletContext
 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, getMap, removeAttribute, setAttribute, setMap
 
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 class: Context
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.

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 class: Context
Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.

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 class: Context
Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

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

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Returns the HttpServletRequest

Returns:
The HttpServletRequest.

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the ServletContext

Returns:
The ServletContext.

getHttpServletResponse

public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Returns the ServletResponse

Returns:
The ServletResponse.