## php.java.script
Class PhpSimpleHttpScriptContext

    java.lang.Object
      javax.script.SimpleScriptContext
          php.java.script.PhpSimpleHttpScriptContext

All Implemented Interfaces:
  ScriptContext, Invocable, IPhpScriptContext

Direct Known Subclasses:
  PhpFacesScriptContext

    public abstract class PhpSimpleHttpScriptContext

extends SimpleScriptContext
implements IPhpScriptContext

A simple ScriptContext which can be used in servlet environments.

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 javax.script.ScriptContext
`ENGINE_SCOPE, GLOBAL_SCOPE`

Constructor Summary
`PhpSimpleHttpScriptContext()`

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.ServletContext` `getContext()` Get the ServletContext
`javax.servlet.http.HttpServletRequest` `getRequest()` Get the HttpServletRequest
`javax.servlet.http.HttpServletResponse` `getResponse()` Get the servlet response
`java.io.Writer` `getWriter()` Retrieves an instance of java.io.Writer which can be used by scripts to display their output.
`void` `initialize(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, PhpScriptWriter writer)` Initilaize the context.
`void` `setAttribute(java.lang.String key, java.lang.Object value, int scope)` Sets an attribute specified by the name in specified level of scope.

Methods inherited from class javax.script.SimpleScriptContext
`getAttributesScope, getBindings, removeAttribute, setBindings`

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

Methods inherited from interface php.java.script.IPhpScriptContext
`getContextManager, getEnvironment, setContinuation`

Methods inherited from interface php.java.bridge.Invocable
`call`

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

### PhpSimpleHttpScriptContext

    public PhpSimpleHttpScriptContext()

Method Detail

### initialize

    public void initialize(javax.servlet.ServletContext ctx,
                           javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse res,
                           PhpScriptWriter writer)
                    throws javax.servlet.ServletException

  Initilaize the context.

  Parameters:
    `ctx` - The ServletContext
    `req` - The HttpServletRequest
    `res` - The HttpServletResponse
    `writer` - The PhpScriptWriter
  Throws:
    `javax.servlet.ServletException`

### getAttribute

    public java.lang.Object getAttribute(java.lang.String key,
                                         int scope)

  Description copied from class: `SimpleScriptContext`
  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 `ScriptContext`
  Overrides:
    `getAttribute` in class `SimpleScriptContext`
  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: `SimpleScriptContext`
  Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.

  Specified by:
    `getAttribute` in interface `ScriptContext`
  Overrides:
    `getAttribute` in class `SimpleScriptContext`
  Parameters:
    `name` - the name of the attribute
  Returns:
    the value of the attribute
  Throws:
    `java.lang.IllegalArgumentException` - if the name is null

### setAttribute

    public void setAttribute(java.lang.String key,
                             java.lang.Object value,
                             int scope)
                      throws java.lang.IllegalArgumentException

  Description copied from class: `SimpleScriptContext`
  Sets an attribute specified by the name in specified level of scope.

  Specified by:
    `setAttribute` in interface `ScriptContext`
  Overrides:
    `setAttribute` in class `SimpleScriptContext`
  Parameters:
    `key` - the name of the attribute
    `value` - the value of the attribute
    `scope` - the level of the scope
  Throws:
    `java.lang.IllegalArgumentException` - if the name is null or the scope is invalid

### getWriter

    public java.io.Writer getWriter()

  Description copied from class: `SimpleScriptContext`
  Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

  Specified by:
    `getWriter` in interface `ScriptContext`
  Specified by:
    `getWriter` in interface `IPhpScriptContext`
  Overrides:
    `getWriter` in class `SimpleScriptContext`
  Returns:
    an instance of java.io.Writer

### getResponse

    public javax.servlet.http.HttpServletResponse getResponse()

  Get the servlet response

  Returns:
    The HttpServletResponse

### getRequest

    public javax.servlet.http.HttpServletRequest getRequest()

  Get the HttpServletRequest

  Returns:
    The HttpServletRequest

### getContext

    public javax.servlet.ServletContext getContext()

  Get the ServletContext

  Returns:
    The current ServletContext