Class DefaultPageContext

java.lang.Object
javax.servlet.jsp.PageContext
javax.servlet.jsp.DefaultPageContext

public class DefaultPageContext extends PageContext
Default implementation of PageContext for Gumdrop JSP support.

This provides a working implementation of the JSP PageContext class, managing page-scope attributes and providing access to servlet API objects.

Author:
Chris Burdess
  • Field Summary

    Fields inherited from class javax.servlet.jsp.PageContext

    APPLICATION_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE
  • Method Summary

    Modifier and Type
    Method
    Description
    Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
    void
    forward(String relativeUrlPath)
    This method is used to re-direct, or "forward" the current ServletRequest and ServletResponse to another active component in the application.
    Return the object associated with the name in the page scope or null if not found.
    getAttribute(String name, int scope)
    Return the object associated with the name in the specified scope or null if not found.
    Enumerate all the attributes in a given scope.
    int
    Get the scope where a given attribute is defined.
    Return the current value of the exception object (Exception).
    Return the current JspWriter stream being used for client response.
    Return the current value of the page object (Servlet).
    javax.servlet.ServletRequest
    Return the current value of the request object (ServletRequest).
    javax.servlet.ServletResponse
    Return the current value of the response object (ServletResponse).
    javax.servlet.ServletConfig
    Return the current value of the config object (ServletConfig).
    javax.servlet.ServletContext
    Return the current value of the context object (ServletContext).
    javax.servlet.http.HttpSession
    Return the current value of the session object (HttpSession).
    void
    This method is intended to process an unhandled "page" level exception.
    void
    This method is intended to process an unhandled "page" level exception.
    void
    include(String relativeUrlPath)
    Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread.
    void
    include(String relativeUrlPath, boolean flush)
    Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread.
    void
    initialize(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush)
    Initialize this PageContext so that it may be used by a JSP Implementation class to service an incoming request and response within the current thread.
    void
    This method is called to release all allocated resources.
    void
    Remove the object reference associated with the specified name.
    void
    removeAttribute(String name, int scope)
    Remove the object reference associated with the specified name in the given scope.
    void
    setAttribute(String name, Object attribute)
    Register the name and value specified with page scope semantics.
    void
    setAttribute(String name, Object o, int scope)
    Register the name and value specified with appropriate scope semantics.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • initialize

      public void initialize(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws IOException
      Description copied from class: PageContext
      Initialize this PageContext so that it may be used by a JSP Implementation class to service an incoming request and response within the current thread.
      Specified by:
      initialize in class PageContext
      Throws:
      IOException
    • release

      public void release()
      Description copied from class: PageContext
      This method is called to release all allocated resources.
      Specified by:
      release in class PageContext
    • getSession

      public javax.servlet.http.HttpSession getSession()
      Description copied from class: PageContext
      Return the current value of the session object (HttpSession).
      Specified by:
      getSession in class PageContext
    • getPage

      public Object getPage()
      Description copied from class: PageContext
      Return the current value of the page object (Servlet).
      Specified by:
      getPage in class PageContext
    • getRequest

      public javax.servlet.ServletRequest getRequest()
      Description copied from class: PageContext
      Return the current value of the request object (ServletRequest).
      Specified by:
      getRequest in class PageContext
    • getResponse

      public javax.servlet.ServletResponse getResponse()
      Description copied from class: PageContext
      Return the current value of the response object (ServletResponse).
      Specified by:
      getResponse in class PageContext
    • getException

      public Exception getException()
      Description copied from class: PageContext
      Return the current value of the exception object (Exception).
      Specified by:
      getException in class PageContext
    • getServletConfig

      public javax.servlet.ServletConfig getServletConfig()
      Description copied from class: PageContext
      Return the current value of the config object (ServletConfig).
      Specified by:
      getServletConfig in class PageContext
    • getServletContext

      public javax.servlet.ServletContext getServletContext()
      Description copied from class: PageContext
      Return the current value of the context object (ServletContext).
      Specified by:
      getServletContext in class PageContext
    • getOut

      public JspWriter getOut()
      Description copied from class: PageContext
      Return the current JspWriter stream being used for client response.
      Specified by:
      getOut in class PageContext
    • setAttribute

      public void setAttribute(String name, Object attribute)
      Description copied from class: PageContext
      Register the name and value specified with page scope semantics.
      Specified by:
      setAttribute in class PageContext
    • setAttribute

      public void setAttribute(String name, Object o, int scope)
      Description copied from class: PageContext
      Register the name and value specified with appropriate scope semantics.
      Specified by:
      setAttribute in class PageContext
    • getAttribute

      public Object getAttribute(String name)
      Description copied from class: PageContext
      Return the object associated with the name in the page scope or null if not found.
      Specified by:
      getAttribute in class PageContext
    • getAttribute

      public Object getAttribute(String name, int scope)
      Description copied from class: PageContext
      Return the object associated with the name in the specified scope or null if not found.
      Specified by:
      getAttribute in class PageContext
    • findAttribute

      public Object findAttribute(String name)
      Description copied from class: PageContext
      Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
      Specified by:
      findAttribute in class PageContext
    • removeAttribute

      public void removeAttribute(String name)
      Description copied from class: PageContext
      Remove the object reference associated with the specified name.
      Specified by:
      removeAttribute in class PageContext
    • removeAttribute

      public void removeAttribute(String name, int scope)
      Description copied from class: PageContext
      Remove the object reference associated with the specified name in the given scope.
      Specified by:
      removeAttribute in class PageContext
    • getAttributesScope

      public int getAttributesScope(String name)
      Description copied from class: PageContext
      Get the scope where a given attribute is defined.
      Specified by:
      getAttributesScope in class PageContext
    • getAttributeNamesInScope

      public Enumeration<String> getAttributeNamesInScope(int scope)
      Description copied from class: PageContext
      Enumerate all the attributes in a given scope.
      Specified by:
      getAttributeNamesInScope in class PageContext
    • handlePageException

      public void handlePageException(Exception e) throws IOException
      Description copied from class: PageContext
      This method is intended to process an unhandled "page" level exception.
      Specified by:
      handlePageException in class PageContext
      Throws:
      IOException
    • handlePageException

      public void handlePageException(Throwable t) throws IOException
      Description copied from class: PageContext
      This method is intended to process an unhandled "page" level exception.
      Specified by:
      handlePageException in class PageContext
      Throws:
      IOException
    • forward

      public void forward(String relativeUrlPath) throws IOException
      Description copied from class: PageContext
      This method is used to re-direct, or "forward" the current ServletRequest and ServletResponse to another active component in the application.
      Specified by:
      forward in class PageContext
      Throws:
      IOException
    • include

      public void include(String relativeUrlPath) throws IOException
      Description copied from class: PageContext
      Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread.
      Specified by:
      include in class PageContext
      Throws:
      IOException
    • include

      public void include(String relativeUrlPath, boolean flush) throws IOException
      Description copied from class: PageContext
      Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread.
      Specified by:
      include in class PageContext
      Throws:
      IOException