|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.PageContext | +--org.apache.jasper.runtime.PageContextImpl
Implementation of the PageContext class from the JSP spec.
Fields inherited from class javax.servlet.jsp.PageContext |
APPLICATION, APPLICATION_SCOPE, CONFIG, EXCEPTION, OUT, PAGE, PAGE_SCOPE, PAGECONTEXT, REQUEST, REQUEST_SCOPE, RESPONSE, SESSION, SESSION_SCOPE |
Method Summary | |
java.lang.Object |
findAttribute(java.lang.String name)
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(java.lang.String relativeUrlPath)
This method is used to re-direct, or "forward" the current ServletRequest and ServletResponse to another active component in the application. |
java.lang.Object |
getAttribute(java.lang.String name)
return the object associated with the name in the page scope or null |
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
return the object associated with the name in the specifed scope or null |
java.util.Enumeration |
getAttributeNamesInScope(int scope)
|
int |
getAttributesScope(java.lang.String name)
|
java.lang.Exception |
getException()
|
JspWriter |
getOut()
|
java.lang.Object |
getPage()
|
ServletRequest |
getRequest()
|
ServletResponse |
getResponse()
|
Servlet |
getServlet()
|
ServletConfig |
getServletConfig()
|
ServletContext |
getServletContext()
|
HttpSession |
getSession()
|
void |
handlePageException(java.lang.Exception e)
This method is intended to process an unhandled "page" level exception by redirecting the exception to either the specified error page for this JSP, or if none was specified, to perform some implementation dependent action. |
void |
include(java.lang.String relativeUrlPath)
Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread. |
void |
initialize(Servlet servlet,
ServletRequest request,
ServletResponse response,
java.lang.String errorPageURL,
boolean needsSession,
int bufferSize,
boolean autoFlush)
The initialize emthod is called to initialize an uninitialized PageContext so that it may be used by a JSP Implementation class to service an incoming request and response wihtin it's _jspService() method. |
JspWriter |
popBody()
Return the previous JspWriter "out" saved by the matching pushBody(), and update the value of the "out" attribute in the page scope attribute namespace of the PageConxtext |
BodyContent |
pushBody()
Return a new BodyContent object, save the current "out" JspWriter, and update the value of the "out" attribute in the page scope attribute namespace of the PageContext |
void |
release()
This method shall "reset" the internal state of a PageContext, releasing all internal references, and preparing the PageContext for potential reuse by a later invocation of initialize(). |
void |
removeAttribute(java.lang.String name)
remove the object reference associated with the specified name |
void |
removeAttribute(java.lang.String name,
int scope)
remove the object reference associated with the specified name |
void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
register the name and object specified with page scope semantics |
void |
setAttribute(java.lang.String name,
java.lang.Object o,
int scope)
register the name and object specified with appropriate scope semantics |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void initialize(Servlet servlet, ServletRequest request, ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
PageContext
The initialize emthod is called to initialize an uninitialized PageContext so that it may be used by a JSP Implementation class to service an incoming request and response wihtin it's _jspService() method.
This method is typically called from JspFactory.getPageContext() in order to initialize state.
This method is required to create an initial JspWriter, and associate the "out" name in page scope with this newly created object.
initialize
in class PageContext
javax.servlet.jsp.PageContext
servlet
- The Servlet that is associated with this PageContextrequest
- The currently pending request for this Servletresponse
- The currently pending response for this ServleterrorPageURL
- The value of the errorpage attribute from the page directive or nullneedsSession
- The value of the session attribute from the page directivebufferSize
- The value of the buffer attribute from the page directiveautoFlush
- The value of the autoflush attribute from the page directivejava.io.IOException
- during creation of JspWriterjava.lang.IllegalStateException
- if out not correctly initializedpublic void release()
PageContext
This method shall "reset" the internal state of a PageContext, releasing all internal references, and preparing the PageContext for potential reuse by a later invocation of initialize(). This method is typically called from JspFactory.releasePageContext().
subclasses shall envelope this method
release
in class PageContext
public java.lang.Object getAttribute(java.lang.String name)
PageContext
return the object associated with the name in the page scope or null
getAttribute
in class PageContext
javax.servlet.jsp.PageContext
name
- the name of the attribute to getjava.lang.NullPointerException
- if the name is nulljava.lang.IllegalArgumentException
- if the scope is invalidpublic java.lang.Object getAttribute(java.lang.String name, int scope)
PageContext
return the object associated with the name in the specifed scope or null
getAttribute
in class PageContext
javax.servlet.jsp.PageContext
name
- the name of the attribute to setscope
- the scope with which to associate the name/objectjava.lang.NullPointerException
- if the name is nulljava.lang.IllegalArgumentException
- if the scope is invalidpublic void setAttribute(java.lang.String name, java.lang.Object attribute)
PageContext
setAttribute
in class PageContext
javax.servlet.jsp.PageContext
java.lang.NullPointerException
- if the name or object is nullpublic void setAttribute(java.lang.String name, java.lang.Object o, int scope)
PageContext
setAttribute
in class PageContext
javax.servlet.jsp.PageContext
name
- the name of the attribute to seto
- the object to associate with the namescope
- the scope with which to associate the name/objectjava.lang.NullPointerException
- if the name or object is nulljava.lang.IllegalArgumentException
- if the scope is invalidpublic void removeAttribute(java.lang.String name, int scope)
PageContext
removeAttribute
in class PageContext
public int getAttributesScope(java.lang.String name)
getAttributesScope
in class PageContext
javax.servlet.jsp.PageContext
public java.lang.Object findAttribute(java.lang.String name)
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.
findAttribute
in class PageContext
javax.servlet.jsp.PageContext
public java.util.Enumeration getAttributeNamesInScope(int scope)
getAttributeNamesInScope
in class PageContext
javax.servlet.jsp.PageContext
public void removeAttribute(java.lang.String name)
PageContext
removeAttribute
in class PageContext
public JspWriter getOut()
getOut
in class PageContext
javax.servlet.jsp.PageContext
public HttpSession getSession()
getSession
in class PageContext
javax.servlet.jsp.PageContext
public Servlet getServlet()
public ServletConfig getServletConfig()
getServletConfig
in class PageContext
javax.servlet.jsp.PageContext
public ServletContext getServletContext()
getServletContext
in class PageContext
javax.servlet.jsp.PageContext
public ServletRequest getRequest()
getRequest
in class PageContext
javax.servlet.jsp.PageContext
public ServletResponse getResponse()
getResponse
in class PageContext
javax.servlet.jsp.PageContext
public java.lang.Exception getException()
getException
in class PageContext
javax.servlet.jsp.PageContext
public java.lang.Object getPage()
getPage
in class PageContext
javax.servlet.jsp.PageContext
public void include(java.lang.String relativeUrlPath) throws ServletException, java.io.IOException
PageContext
Causes the resource specified to be processed as part of the current ServletRequest and ServletResponse being processed by the calling Thread. The output of the target resources processing of the request is written directly to the ServletResponse output stream.
The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include.
If the relativeUrlPath begins with a "/" then the URL specified
is calculated relative to the DOCROOT of the ServletContext
for this JSP. If the path does not begin with a "/" then the URL
specified is calculated relative to the URL of the request that was
mapped to the calling JSP.
It is only valid to call this method from a Thread
executing within a _jspService(...)
method of a JSP.
include
in class PageContext
javax.servlet.jsp.PageContext
relativeUrlPath
- specifies the relative URL path to the target resource to be includedServletException
- java.io.IOException
- java.lang.IllegalArgumentException
- if the target resource URL is unresolvablejava.lang.SecurityException
- if target resource cannot be accessed by callerpublic void forward(java.lang.String relativeUrlPath) throws ServletException, java.io.IOException
PageContext
This method is used to re-direct, or "forward" the current ServletRequest and ServletResponse to another active component in the application.
If the relativeUrlPath begins with a "/" then the URL specified
is calculated relative to the DOCROOT of the ServletContext
for this JSP. If the path does not begin with a "/" then the URL
specified is calculated relative to the URL of the request that was
mapped to the calling JSP.
It is only valid to call this method from a Thread
executing within a _jspService(...)
method of a JSP.
Once this method has been called successfully, it is illegal for the
calling Thread
to attempt to modify the
ServletResponse
object. Any such attempt to do so, shall result
in undefined behavior. Typically, callers immediately return from
_jspService(...)
after calling this method.
forward
in class PageContext
javax.servlet.jsp.PageContext
relativeUrlPath
- specifies the relative URL path to the target resource as described aboveServletException
- java.io.IOException
- java.lang.IllegalArgumentException
- if target resource URL is unresolvablejava.lang.IllegalStateException
- if ServletResponse
is not in a state where a forward can be performedjava.lang.SecurityException
- if target resource cannot be accessed by callerpublic BodyContent pushBody()
PageContext
pushBody
in class PageContext
javax.servlet.jsp.PageContext
public JspWriter popBody()
PageContext
popBody
in class PageContext
javax.servlet.jsp.PageContext
public void handlePageException(java.lang.Exception e) throws java.io.IOException, ServletException
PageContext
This method is intended to process an unhandled "page" level exception by redirecting the exception to either the specified error page for this JSP, or if none was specified, to perform some implementation dependent action.
A JSP implementation class shall typically clean up any local state prior to invoking this and will return immediately thereafter. It is illegal to generate any output to the client, or to modify any ServletResponse state after invoking this call.
handlePageException
in class PageContext
javax.servlet.jsp.PageContext
e
- the exception to be handledServletException
- java.io.IOException
- java.lang.NullPointerException
- if the exception is nulljava.lang.SecurityException
- if target resource cannot be accessed by caller
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |