## javax.script.http
Class SimpleHttpScriptContext

    java.lang.Object
      javax.script.SimpleScriptContext
          javax.script.http.SimpleHttpScriptContext

All Implemented Interfaces:
  HttpScriptContext, ScriptContext

    public class SimpleHttpScriptContext

extends SimpleScriptContext
implements HttpScriptContext

Field Summary
`static java.lang.String[]` `defaultMethods`

Fields inherited from interface javax.script.http.HttpScriptContext
`APPLICATION_SCOPE, REQUEST_SCOPE, SESSION_SCOPE`

Fields inherited from interface javax.script.ScriptContext
`ENGINE_SCOPE, GLOBAL_SCOPE`

Constructor Summary
`SimpleHttpScriptContext()`

Method Summary
`boolean` `disableScript()` Retrieves a boolean value which indicates whether the script execution has been disabled in the Web Application.
`boolean` `displayResults()` Retrieves a boolean value which indicates whether the HttpScriptServlet executing in this context should display the results of script evaluations.
`void` `forward(java.lang.String relativePath)` Forwards the request to the resource identified by the specified relative path.
`java.lang.String[]` `getAllowedLanguages()` Retrieves an array of Strings describing the languages that may be used by scripts which is running in the associated HttpScriptContext.
`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.String[]` `getMethods()` Retrieves an array of string describing HTTP request methods which are handled by servlets executing in current context.
`javax.servlet.http.HttpServletRequest` `getRequest()` Retrieves a HttpScriptRequest for the current request.
`javax.servlet.http.HttpServletResponse` `getResponse()` Retrieves a HttpScriptResponse for the current request.
`java.io.Reader` `getScriptSource()` Retrieves a reader form which the executing script can be read.
`javax.servlet.Servlet` `getServlet()` Retrieves the associated HttpScriptServlet.
`java.io.Writer` `getWriter()` Retrieves an instance of java.io.Writer which can be used by scripts to display their output.
`void` `include(java.lang.String relativePath)` Includes the resource in the sepcified relative path.
`void` `initialize(javax.servlet.Servlet servlet, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)` Initialize the current HttpScriptContext for processing of single request.
`static void` `initializeGlobal(javax.servlet.ServletConfig config)`
`void` `release()` Clears any state stored in the current HttpScriptContext such that it can be reused to serve another request.
`void` `setAttribute(java.lang.String key, java.lang.Object value, int scope)` Sets an attribute specified by the name in specified level of scope.
`boolean` `useSession()` Retrieves a boolean value which indicates whether the HttpSession associated with the current request is exposed in SESSION_SCOPE attribute and in the HttpScriptRequest.

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

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

Methods inherited from interface javax.script.http.HttpScriptContext
`getAttribute`

Methods inherited from interface javax.script.ScriptContext
`getAttributesScope, getBindings, removeAttribute, setBindings`

Field Detail

### defaultMethods

    public static final java.lang.String[] defaultMethods

Constructor Detail

### SimpleHttpScriptContext

    public SimpleHttpScriptContext()

Method Detail

### disableScript

    public boolean disableScript()

  Description copied from interface: `HttpScriptContext`
  Retrieves a boolean value which indicates whether the script execution has been disabled in the Web Application.

  Specified by:
    `disableScript` in interface `HttpScriptContext`
  Returns:
    a booean indicating whether the script execution is allowed

### displayResults

    public boolean displayResults()

  Description copied from interface: `HttpScriptContext`
  Retrieves a boolean value which indicates whether the HttpScriptServlet executing in this context should display the results of script evaluations.

  Specified by:
    `displayResults` in interface `HttpScriptContext`
  Returns:
    a boolean indicating whether the results of script eveluations should be displayed

### getAllowedLanguages

    public java.lang.String[] getAllowedLanguages()

  Description copied from interface: `HttpScriptContext`
  Retrieves an array of Strings describing the languages that may be used by scripts which is running in the associated HttpScriptContext. Returns null if no restrictions apply.

  Specified by:
    `getAllowedLanguages` in interface `HttpScriptContext`
  Returns:
    a String array of permitted languages

### 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 `HttpScriptContext`
  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

### 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 `HttpScriptContext`
  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

### forward

    public void forward(java.lang.String relativePath)
                 throws javax.servlet.ServletException,
                        java.io.IOException

  Description copied from interface: `HttpScriptContext`
  Forwards the request to the resource identified by the specified relative path.

  Specified by:
    `forward` in interface `HttpScriptContext`
  Parameters:
    `relativePath` - the URI to process the request
  Throws:
    `javax.servlet.ServletException` - if the HTTP cannot be handled
    `java.io.IOException` - if an input or output error occurs while processing the HTTP request

### getMethods

    public java.lang.String[] getMethods()

  Description copied from interface: `HttpScriptContext`
  Retrieves an array of string describing HTTP request methods which are handled by servlets executing in current context.

  Specified by:
    `getMethods` in interface `HttpScriptContext`
  Returns:
    a String array of HTTP request methods handled by servelts in the current context

### getRequest

    public javax.servlet.http.HttpServletRequest getRequest()

  Description copied from interface: `HttpScriptContext`
  Retrieves a HttpScriptRequest for the current request. If the session state is disabled, an adapter whose getSession() method returns null should be used.

  Specified by:
    `getRequest` in interface `HttpScriptContext`
  Returns:
    the current request

### getResponse

    public javax.servlet.http.HttpServletResponse getResponse()

  Description copied from interface: `HttpScriptContext`
  Retrieves a HttpScriptResponse for the current request.

  Specified by:
    `getResponse` in interface `HttpScriptContext`
  Returns:
    the current response

### getScriptSource

    public java.io.Reader getScriptSource()

  Description copied from interface: `HttpScriptContext`
  Retrieves a reader form which the executing script can be read.

  Specified by:
    `getScriptSource` in interface `HttpScriptContext`
  Returns:
    a reader from which the script can be read.

### getServlet

    public javax.servlet.Servlet getServlet()

  Description copied from interface: `HttpScriptContext`
  Retrieves the associated HttpScriptServlet.

  Specified by:
    `getServlet` in interface `HttpScriptContext`
  Returns:
    a reader form which the script source can be read

### include

    public void include(java.lang.String relativePath)
                 throws javax.servlet.ServletException,
                        java.io.IOException

  Description copied from interface: `HttpScriptContext`
  Includes the resource in the sepcified relative path.

  Specified by:
    `include` in interface `HttpScriptContext`
  Parameters:
    `relativePath` - the URI of the request to be processed
  Throws:
    `javax.servlet.ServletException` - if the servlet cannot handled the HTTP request
    `java.io.IOException` - if an input or output error occurs while processing the HTTP request

### initialize

    public void initialize(javax.servlet.Servlet servlet,
                           javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse res)
                    throws javax.servlet.ServletException

  Description copied from interface: `HttpScriptContext`
  Initialize the current HttpScriptContext for processing of single request. Implementation must initialize request, session and application scopes. Further it should store servlet, request and response references for use.

  Specified by:
    `initialize` in interface `HttpScriptContext`
  Parameters:
    `servlet` - the HttpServlet which execute the request
    `req` - the current request
    `res` - the current response
  Throws:
    `javax.servlet.ServletException` - if the servlet cannot handle the HTTP request

### initializeGlobal

    public static void initializeGlobal(javax.servlet.ServletConfig config)
                                 throws javax.servlet.ServletException

  Throws:
    `javax.servlet.ServletException`

### release

    public void release()

  Description copied from interface: `HttpScriptContext`
  Clears any state stored in the current HttpScriptContext such that it can be reused to serve another request.

  Specified by:
    `release` in interface `HttpScriptContext`

### useSession

    public boolean useSession()

  Description copied from interface: `HttpScriptContext`
  Retrieves a boolean value which indicates whether the HttpSession associated with the current request is exposed in SESSION_SCOPE attribute and in the HttpScriptRequest.

  Specified by:
    `useSession` in interface `HttpScriptContext`
  Returns:
    a boolean value which indicates whether the session is vaild

### 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`
  Overrides:
    `getWriter` in class `SimpleScriptContext`
  Returns:
    an instance of java.io.Writer