|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.JspContext javax.servlet.jsp.PageContext org.apache.jasper.runtime.JspContextWrapper
public class JspContextWrapper
Implementation of a JSP Context Wrapper. The JSP Context Wrapper is a JspContext created and maintained by a tag handler implementation. It wraps the Invoking JSP Context, that is, the JspContext instance passed to the tag handler by the invoking page via setJspContext().
Field Summary |
---|
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 |
Constructor Summary | |
---|---|
JspContextWrapper(javax.servlet.jsp.JspContext jspContext,
java.util.ArrayList nestedVars,
java.util.ArrayList atBeginVars,
java.util.ArrayList atEndVars,
java.util.Map aliases)
|
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)
Returns the object associated with the name in the page scope or null if not found. |
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
Return the object associated with the name in the specified scope or null if not found. |
java.util.Enumeration<java.lang.String> |
getAttributeNamesInScope(int scope)
Enumerate all the attributes in a given scope. |
int |
getAttributesScope(java.lang.String name)
Get the scope where a given attribute is defined. |
javax.el.ELContext |
getELContext()
Returns the ELContext associated with this
JspContext . |
java.lang.Exception |
getException()
The current value of the exception object (an Exception). |
javax.servlet.jsp.el.ExpressionEvaluator |
getExpressionEvaluator()
Provides programmatic access to the ExpressionEvaluator. |
javax.servlet.jsp.JspWriter |
getOut()
The current value of the out object (a JspWriter). |
java.lang.Object |
getPage()
The current value of the page object (In a Servlet environment, this is an instance of javax.servlet.Servlet). |
javax.servlet.ServletRequest |
getRequest()
The current value of the request object (a ServletRequest). |
javax.servlet.ServletResponse |
getResponse()
The current value of the response object (a ServletResponse). |
javax.servlet.ServletConfig |
getServletConfig()
The ServletConfig instance. |
javax.servlet.ServletContext |
getServletContext()
The ServletContext instance. |
javax.servlet.http.HttpSession |
getSession()
The current value of the session object (an HttpSession). |
javax.servlet.jsp.el.VariableResolver |
getVariableResolver()
Returns an instance of a VariableResolver that provides access to the implicit objects specified in the JSP specification using this JspContext as the context object. |
void |
handlePageException(java.lang.Exception ex)
This method is intended to process an unhandled 'page' level exception by forwarding the exception to the specified error page for this JSP. |
void |
handlePageException(java.lang.Throwable t)
This method is intended to process an unhandled 'page' level exception by forwarding the exception to the specified error page for this JSP. |
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 |
include(java.lang.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,
java.lang.String errorPageURL,
boolean needsSession,
int bufferSize,
boolean autoFlush)
The initialize method 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 within it's _jspService() method. |
javax.servlet.jsp.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 JspContext. |
javax.servlet.jsp.tagext.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. |
javax.servlet.jsp.JspWriter |
pushBody(java.io.Writer writer)
Return a new JspWriter object that sends output to the provided Writer. |
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 given name from all scopes. |
void |
removeAttribute(java.lang.String name,
int scope)
Remove the object reference associated with the specified name in the given scope. |
java.lang.Object |
resolveVariable(java.lang.String pName)
VariableResolver interface |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Register the name and value specified with page scope semantics. |
void |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
Register the name and value specified with appropriate scope semantics. |
void |
syncBeforeInvoke()
Synchronize variables before fragment invokation |
void |
syncBeginTagFile()
Synchronize variables at begin of tag file |
void |
syncEndTagFile()
Synchronize variables at end of tag file |
Methods inherited from class javax.servlet.jsp.PageContext |
---|
getErrorData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JspContextWrapper(javax.servlet.jsp.JspContext jspContext, java.util.ArrayList nestedVars, java.util.ArrayList atBeginVars, java.util.ArrayList atEndVars, java.util.Map aliases)
Method Detail |
---|
public void initialize(javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws java.io.IOException, java.lang.IllegalStateException, java.lang.IllegalArgumentException
javax.servlet.jsp.PageContext
The initialize method 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 within 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.
This method should not be used by page or tag library authors.
initialize
in class 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
directive
java.io.IOException
- during creation of JspWriter
java.lang.IllegalStateException
- if out not correctly initialized
java.lang.IllegalArgumentException
- If one of the given parameters
is invalidpublic java.lang.Object getAttribute(java.lang.String name)
javax.servlet.jsp.JspContext
getAttribute
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to get
public java.lang.Object getAttribute(java.lang.String name, int scope)
javax.servlet.jsp.JspContext
getAttribute
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to setscope
- the scope with which to associate the name/object
public void setAttribute(java.lang.String name, java.lang.Object value)
javax.servlet.jsp.JspContext
null
, this has the same
effect as calling
removeAttribute( name, PageContext.PAGE_SCOPE )
.
setAttribute
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to setvalue
- the value to associate with the name, or null if the
attribute is to be removed from the page scope.public void setAttribute(java.lang.String name, java.lang.Object value, int scope)
javax.servlet.jsp.JspContext
null
,
this has the same effect as calling
removeAttribute( name, scope )
.
setAttribute
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to setvalue
- the object to associate with the name, or null if
the attribute is to be removed from the specified scope.scope
- the scope with which to associate the name/objectpublic java.lang.Object findAttribute(java.lang.String name)
javax.servlet.jsp.JspContext
findAttribute
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to search for
public void removeAttribute(java.lang.String name)
javax.servlet.jsp.JspContext
removeAttribute
in class javax.servlet.jsp.JspContext
name
- The name of the object to remove.public void removeAttribute(java.lang.String name, int scope)
javax.servlet.jsp.JspContext
removeAttribute
in class javax.servlet.jsp.JspContext
name
- The name of the object to remove.scope
- The scope where to look.public int getAttributesScope(java.lang.String name)
javax.servlet.jsp.JspContext
getAttributesScope
in class javax.servlet.jsp.JspContext
name
- the name of the attribute to return the scope for
public java.util.Enumeration<java.lang.String> getAttributeNamesInScope(int scope)
javax.servlet.jsp.JspContext
getAttributeNamesInScope
in class javax.servlet.jsp.JspContext
scope
- the scope to enumerate all the attributes for
public void release()
javax.servlet.jsp.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.
This method should not be used by page or tag library authors.
release
in class javax.servlet.jsp.PageContext
public javax.servlet.jsp.JspWriter getOut()
javax.servlet.jsp.JspContext
getOut
in class javax.servlet.jsp.JspContext
public javax.servlet.http.HttpSession getSession()
javax.servlet.jsp.PageContext
getSession
in class javax.servlet.jsp.PageContext
public java.lang.Object getPage()
javax.servlet.jsp.PageContext
getPage
in class javax.servlet.jsp.PageContext
public javax.servlet.ServletRequest getRequest()
javax.servlet.jsp.PageContext
getRequest
in class javax.servlet.jsp.PageContext
public javax.servlet.ServletResponse getResponse()
javax.servlet.jsp.PageContext
getResponse
in class javax.servlet.jsp.PageContext
public java.lang.Exception getException()
javax.servlet.jsp.PageContext
getException
in class javax.servlet.jsp.PageContext
public javax.servlet.ServletConfig getServletConfig()
javax.servlet.jsp.PageContext
getServletConfig
in class javax.servlet.jsp.PageContext
public javax.servlet.ServletContext getServletContext()
javax.servlet.jsp.PageContext
getServletContext
in class javax.servlet.jsp.PageContext
public void forward(java.lang.String relativeUrlPath) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.jsp.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 javax.servlet.jsp.PageContext
relativeUrlPath
- specifies the relative URL path to the target
resource as described above
javax.servlet.ServletException
- if the page that was forwarded to throws
a ServletException
java.io.IOException
- if an I/O error occurred while forwardingpublic void include(java.lang.String relativeUrlPath) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.jsp.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 javax.servlet.jsp.PageContext
relativeUrlPath
- specifies the relative URL path to the target
resource to be included
javax.servlet.ServletException
- if the page that was forwarded to throws
a ServletException
java.io.IOException
- if an I/O error occurred while forwardingpublic void include(java.lang.String relativeUrlPath, boolean flush) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.jsp.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 current JspWriter returned by a call to getOut().
If flush is true, The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include. Otherwise, the JspWriter "out" is not flushed.
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 javax.servlet.jsp.PageContext
relativeUrlPath
- specifies the relative URL path to the
target resource to be includedflush
- True if the JspWriter is to be flushed before the include,
or false if not.
javax.servlet.ServletException
- if the page that was forwarded to throws
a ServletException
java.io.IOException
- if an I/O error occurred while forwardingpublic javax.servlet.jsp.el.VariableResolver getVariableResolver()
javax.servlet.jsp.JspContext
getVariableResolver
in class javax.servlet.jsp.JspContext
public javax.servlet.jsp.tagext.BodyContent pushBody()
javax.servlet.jsp.PageContext
pushBody
in class javax.servlet.jsp.PageContext
public javax.servlet.jsp.JspWriter pushBody(java.io.Writer writer)
javax.servlet.jsp.JspContext
The returned JspWriter must implement all methods and behave as though it were unbuffered. More specifically:
pushBody
in class javax.servlet.jsp.JspContext
writer
- The Writer for the returned JspWriter to send
output to.
public javax.servlet.jsp.JspWriter popBody()
javax.servlet.jsp.JspContext
popBody
in class javax.servlet.jsp.JspContext
public javax.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator()
javax.servlet.jsp.JspContext
getExpressionEvaluator
in class javax.servlet.jsp.JspContext
public void handlePageException(java.lang.Exception ex) throws java.io.IOException, javax.servlet.ServletException
javax.servlet.jsp.PageContext
This method is intended to process an unhandled 'page' level exception by forwarding the exception to the specified error page for this JSP. If forwarding is not possible (for example because the response has already been committed), an implementation dependent mechanism should be used to invoke the error page (e.g. "including" the error page instead).
If no error page is defined in the page, the exception should be rethrown so that the standard servlet error handling takes over.
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.
This method is kept for backwards compatiblity reasons. Newly generated code should use PageContext.handlePageException(Throwable).
handlePageException
in class javax.servlet.jsp.PageContext
ex
- the exception to be handled
java.io.IOException
- if an I/O error occurred while invoking the error
page
javax.servlet.ServletException
- if an error occurs while invoking the error pagePageContext.handlePageException(Throwable)
public void handlePageException(java.lang.Throwable t) throws java.io.IOException, javax.servlet.ServletException
javax.servlet.jsp.PageContext
This method is intended to process an unhandled 'page' level exception by forwarding the exception to the specified error page for this JSP. If forwarding is not possible (for example because the response has already been committed), an implementation dependent mechanism should be used to invoke the error page (e.g. "including" the error page instead).
If no error page is defined in the page, the exception should be rethrown so that the standard servlet error handling takes over.
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 javax.servlet.jsp.PageContext
t
- the throwable to be handled
java.io.IOException
- if an I/O error occurred while invoking the error
page
javax.servlet.ServletException
- if an error occurs while invoking the error pagePageContext.handlePageException(Exception)
public java.lang.Object resolveVariable(java.lang.String pName) throws javax.servlet.jsp.el.ELException
resolveVariable
in interface javax.servlet.jsp.el.VariableResolver
pName
- the name of the variable to resolve
javax.servlet.jsp.el.ELException
- if a failure occurred while trying to resolve
the given variablepublic void syncBeginTagFile()
public void syncBeforeInvoke()
public void syncEndTagFile()
public javax.el.ELContext getELContext()
javax.servlet.jsp.JspContext
ELContext
associated with this
JspContext
.
The ELContext
is created lazily and is reused if
it already exists. There is a new ELContext
for each
JspContext
.
The ELContext
must contain the ELResolver
described in the JSP specification (and in the javadocs for
JspApplicationContext.addELResolver(javax.el.ELResolver)
).
getELContext
in class javax.servlet.jsp.JspContext
ELContext
associated with this
JspContext
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |