php.java.bridge.http
Interface IContext

All Known Subinterfaces:
IPhpScriptContext
All Known Implementing Classes:
AbstractPhpScriptContext, Context, Context, PhpScriptContext, PhpSimpleHttpScriptContext, RemoteContext

public interface IContext

Interface which all contexts must implement. Used when the JSR223 interface is not available.

Author:
jostb

Field Summary
static int ENGINE_SCOPE
          The engine scope
static int GLOBAL_SCOPE
          The global scope
static java.lang.String JAVA_BRIDGE
          This key can be used to get the current JavaBridge instance.
static java.lang.String SERVLET
          This key can be used to get the current Servlet instance.
static java.lang.String SERVLET_CONFIG
          This key can be used to get the current ServletConfig instance.
static java.lang.String SERVLET_CONTEXT
          This key can be used to get the current ServletContext instance.
static java.lang.String SERVLET_REQUEST
          This key can be used to get the current HttpServletRequest instance.
static java.lang.String SERVLET_RESPONSE
          This key can be used to get the current HttpServletResponse instance.
 
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 name, int scope)
          Retrieves the value associated with specified name in the specified level of scope.
 int getAttributesScope(java.lang.String name)
          Retrieves the lowest value of scopes for which the attribute is defined.
 java.io.Writer getWriter()
          Retrieves an instance of java.io.Writer which can be used by scripts to display their output.
 java.lang.Object removeAttribute(java.lang.String name, int scope)
          Removes the specified attribute form the specified level of scope.
 void setAttribute(java.lang.String name, java.lang.Object value, int scope)
          Sets an attribute specified by the name in specified level of scope.
 

Field Detail

ENGINE_SCOPE

static final int ENGINE_SCOPE
The engine scope

See Also:
Constant Field Values

GLOBAL_SCOPE

static final int GLOBAL_SCOPE
The global scope

See Also:
Constant Field Values

JAVA_BRIDGE

static final java.lang.String JAVA_BRIDGE
This key can be used to get the current JavaBridge instance. Example: java_context->getAttribute("php.java.bridge.JavaBridge");

See Also:
Constant Field Values

SERVLET_CONTEXT

static final java.lang.String SERVLET_CONTEXT
This key can be used to get the current ServletContext instance. Example: java_context->getAttribute("php.java.servlet.ServletContext");

See Also:
Constant Field Values

SERVLET_CONFIG

static final java.lang.String SERVLET_CONFIG
This key can be used to get the current ServletConfig instance. Example: java_context->getAttribute("php.java.servlet.ServletConfig");

See Also:
Constant Field Values

SERVLET

static final java.lang.String SERVLET
This key can be used to get the current Servlet instance. Example: java_context->getAttribute("php.java.servlet.Servlet");

See Also:
Constant Field Values

SERVLET_REQUEST

static final java.lang.String SERVLET_REQUEST
This key can be used to get the current HttpServletRequest instance. Example: java_context->getAttribute("php.java.servlet.HttpServletRequest");

See Also:
Constant Field Values

SERVLET_RESPONSE

static final java.lang.String SERVLET_RESPONSE
This key can be used to get the current HttpServletResponse instance. Example: java_context->getAttribute("php.java.servlet.HttpServletResponse");

See Also:
Constant Field Values
Method Detail

getAttribute

java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.

Parameters:
name - the name of the attribute
Returns:
the value of the attribute
Throws:
java.lang.IllegalArgumentException

getAttribute

java.lang.Object getAttribute(java.lang.String name,
                              int scope)
                              throws java.lang.IllegalArgumentException
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.

Parameters:
name - the name of the attribute
scope - the level of scope
Returns:
the value value associated with the specified name in specified level of scope
Throws:
java.lang.IllegalArgumentException

getAttributesScope

int getAttributesScope(java.lang.String name)
Retrieves the lowest value of scopes for which the attribute is defined. If there is no associate scope with the given attribute (-1) is returned.

Parameters:
name - the name of attribute
Returns:
the value of level of scope

getWriter

java.io.Writer getWriter()
                         throws java.io.IOException
Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

Returns:
an instance of java.io.Writer
Throws:
java.io.IOException

removeAttribute

java.lang.Object removeAttribute(java.lang.String name,
                                 int scope)
                                 throws java.lang.IllegalArgumentException
Removes the specified attribute form the specified level of scope.

Parameters:
name - the name of the attribute
scope - the level of scope
Returns:
value which is removed
Throws:
java.lang.IllegalArgumentException

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value,
                  int scope)
                  throws java.lang.IllegalArgumentException
Sets an attribute specified by the name in specified level of scope.

Parameters:
name - the name of the attribute
value - the value of the attribute
scope - the level of the scope
Throws:
IllegalArguementException - if the name is null scope is invlaid
java.lang.IllegalArgumentException