Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## php.java.servlet
Class Context

    java.lang.Object
      php.java.bridge.http.Context
          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()` Deprecated. Use java_context()->getAttribute(...) instead
`java.lang.Object` | `getHttpServletResponse()` Deprecated. Use java_context()->getAttribute(...) instead
`java.lang.Object` | `getServletContext()` Deprecated. 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`

### getHttpServletRequest

    public java.lang.Object getHttpServletRequest()

  Deprecated. Use java_context()->getAttribute(...) instead

  Returns the HttpServletRequest

  Overrides:
    `getHttpServletRequest` in class `Context`
  Returns:
    The HttpServletRequest.

### getServletContext

    public java.lang.Object getServletContext()

  Deprecated. Use java_context()->getAttribute(...) instead

  Returns the ServletContext

  Overrides:
    `getServletContext` in class `Context`
  Returns:
    The ServletContext.

### getHttpServletResponse

    public java.lang.Object getHttpServletResponse()

  Deprecated. Use java_context()->getAttribute(...) instead

  Returns the ServletResponse

  Overrides:
    `getHttpServletResponse` in class `Context`
  Returns:
    The ServletResponse.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD