Class JspContextWrapper
- java.lang.Object
- 
- javax.servlet.jsp.JspContext
- 
- javax.servlet.jsp.PageContext
- 
- org.apache.jasper.runtime.JspContextWrapper
 
 
 
- 
- All Implemented Interfaces:
- VariableResolver
 
 public class JspContextWrapper extends PageContext implements VariableResolver 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().- Author:
- Kin-man Chung, Jan Luehe, Jacob Hookom
 
- 
- 
Field Summary- 
Fields inherited from class javax.servlet.jsp.PageContextAPPLICATION, APPLICATION_SCOPE, CONFIG, EXCEPTION, OUT, PAGE, PAGE_SCOPE, PAGECONTEXT, REQUEST, REQUEST_SCOPE, RESPONSE, SESSION, SESSION_SCOPE
 
- 
 - 
Constructor SummaryConstructors Constructor Description JspContextWrapper(JspTag jspTag, JspContext jspContext, java.util.ArrayList<java.lang.String> nestedVars, java.util.ArrayList<java.lang.String> atBeginVars, java.util.ArrayList<java.lang.String> atEndVars, java.util.Map<java.lang.String,java.lang.String> aliases)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.ObjectfindAttribute(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.voidforward(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.ObjectgetAttribute(java.lang.String name)Returns the object associated with the name in the page scope or null if not found.java.lang.ObjectgetAttribute(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.intgetAttributesScope(java.lang.String name)Get the scope where a given attribute is defined.ELContextgetELContext()Obtain the ELContext for this JSPContext.java.lang.ExceptiongetException()The current value of the exception object (an Exception).ExpressionEvaluatorgetExpressionEvaluator()Deprecated.JspWritergetOut()The current value of the out object (a JspWriter).java.lang.ObjectgetPage()The current value of the page object (In a Servlet environment, this is an instance of javax.servlet.Servlet).ServletRequestgetRequest()The current value of the request object (a ServletRequest).ServletResponsegetResponse()The current value of the response object (a ServletResponse).ServletConfiggetServletConfig()The ServletConfig instance.ServletContextgetServletContext()The ServletContext instance.HttpSessiongetSession()The current value of the session object (an HttpSession).VariableResolvergetVariableResolver()Deprecated.voidhandlePageException(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.voidhandlePageException(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.voidinclude(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.voidinclude(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.voidinitialize(Servlet servlet, ServletRequest request, 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.JspWriterpopBody()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.BodyContentpushBody()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.JspWriterpushBody(java.io.Writer writer)Return a new JspWriter object that sends output to the provided Writer.voidrelease()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().voidremoveAttribute(java.lang.String name)Remove the object reference associated with the given name from all scopes.voidremoveAttribute(java.lang.String name, int scope)Remove the object reference associated with the specified name in the given scope.java.lang.ObjectresolveVariable(java.lang.String pName)Deprecated.voidsetAttribute(java.lang.String name, java.lang.Object value)Register the name and value specified with page scope semantics.voidsetAttribute(java.lang.String name, java.lang.Object value, int scope)Register the name and value specified with appropriate scope semantics.voidsyncBeforeInvoke()Synchronize variables before fragment invocationvoidsyncBeginTagFile()Synchronize variables at begin of tag filevoidsyncEndTagFile()Synchronize variables at end of tag file- 
Methods inherited from class javax.servlet.jsp.PageContextgetErrorData
 
- 
 
- 
- 
- 
Constructor Detail- 
JspContextWrapperpublic JspContextWrapper(JspTag jspTag, JspContext jspContext, java.util.ArrayList<java.lang.String> nestedVars, java.util.ArrayList<java.lang.String> atBeginVars, java.util.ArrayList<java.lang.String> atEndVars, java.util.Map<java.lang.String,java.lang.String> aliases) 
 
- 
 - 
Method Detail- 
initializepublic 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 Description copied from class:javax.servlet.jsp.PageContextThe 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. - Specified by:
- initializein class- PageContext
- Parameters:
- servlet- The Servlet that is associated with this PageContext
- request- The currently pending request for this Servlet
- response- The currently pending response for this Servlet
- errorPageURL- The value of the errorpage attribute from the page directive or null
- needsSession- The value of the session attribute from the page directive
- bufferSize- The value of the buffer attribute from the page directive
- autoFlush- The value of the autoflush attribute from the page directive
- Throws:
- 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 invalid
 
 - 
getAttributepublic java.lang.Object getAttribute(java.lang.String name) Description copied from class:javax.servlet.jsp.JspContextReturns the object associated with the name in the page scope or null if not found.- Specified by:
- getAttributein class- JspContext
- Parameters:
- name- the name of the attribute to get
- Returns:
- the object associated with the name in the page scope or null if not found.
 
 - 
getAttributepublic java.lang.Object getAttribute(java.lang.String name, int scope)Description copied from class:javax.servlet.jsp.JspContextReturn the object associated with the name in the specified scope or null if not found.- Specified by:
- getAttributein class- JspContext
- Parameters:
- name- the name of the attribute to set
- scope- the scope with which to associate the name/object
- Returns:
- the object associated with the name in the specified scope or null if not found.
 
 - 
setAttributepublic void setAttribute(java.lang.String name, java.lang.Object value)Description copied from class:javax.servlet.jsp.JspContextRegister the name and value specified with page scope semantics. If the value passed in isnull, this has the same effect as callingremoveAttribute( name, PageContext.PAGE_SCOPE ).- Specified by:
- setAttributein class- JspContext
- Parameters:
- name- the name of the attribute to set
- value- the value to associate with the name, or null if the attribute is to be removed from the page scope.
 
 - 
setAttributepublic void setAttribute(java.lang.String name, java.lang.Object value, int scope)Description copied from class:javax.servlet.jsp.JspContextRegister the name and value specified with appropriate scope semantics. If the value passed in isnull, this has the same effect as callingremoveAttribute( name, scope ).- Specified by:
- setAttributein class- JspContext
- Parameters:
- name- the name of the attribute to set
- value- 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/object
 
 - 
findAttributepublic java.lang.Object findAttribute(java.lang.String name) Description copied from class:javax.servlet.jsp.JspContextSearches 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:
- findAttributein class- JspContext
- Parameters:
- name- the name of the attribute to search for
- Returns:
- the value associated or null
 
 - 
removeAttributepublic void removeAttribute(java.lang.String name) Description copied from class:javax.servlet.jsp.JspContextRemove the object reference associated with the given name from all scopes. Does nothing if there is no such object.- Specified by:
- removeAttributein class- JspContext
- Parameters:
- name- The name of the object to remove.
 
 - 
removeAttributepublic void removeAttribute(java.lang.String name, int scope)Description copied from class:javax.servlet.jsp.JspContextRemove the object reference associated with the specified name in the given scope. Does nothing if there is no such object.- Specified by:
- removeAttributein class- JspContext
- Parameters:
- name- The name of the object to remove.
- scope- The scope where to look.
 
 - 
getAttributesScopepublic int getAttributesScope(java.lang.String name) Description copied from class:javax.servlet.jsp.JspContextGet the scope where a given attribute is defined.- Specified by:
- getAttributesScopein class- JspContext
- Parameters:
- name- the name of the attribute to return the scope for
- Returns:
- the scope of the object associated with the name specified or 0
 
 - 
getAttributeNamesInScopepublic java.util.Enumeration<java.lang.String> getAttributeNamesInScope(int scope) Description copied from class:javax.servlet.jsp.JspContextEnumerate all the attributes in a given scope.- Specified by:
- getAttributeNamesInScopein class- JspContext
- Parameters:
- scope- the scope to enumerate all the attributes for
- Returns:
- an enumeration of names (java.lang.String) of all the attributes the specified scope
 
 - 
releasepublic void release() Description copied from class:javax.servlet.jsp.PageContextThis 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. - Specified by:
- releasein class- PageContext
 
 - 
getOutpublic JspWriter getOut() Description copied from class:javax.servlet.jsp.JspContextThe current value of the out object (a JspWriter).- Specified by:
- getOutin class- JspContext
- Returns:
- the current JspWriter stream being used for client response
 
 - 
getSessionpublic HttpSession getSession() Description copied from class:javax.servlet.jsp.PageContextThe current value of the session object (an HttpSession).- Specified by:
- getSessionin class- PageContext
- Returns:
- the HttpSession for this PageContext or null
 
 - 
getPagepublic java.lang.Object getPage() Description copied from class:javax.servlet.jsp.PageContextThe current value of the page object (In a Servlet environment, this is an instance of javax.servlet.Servlet).- Specified by:
- getPagein class- PageContext
- Returns:
- the Page implementation class instance associated with this PageContext
 
 - 
getRequestpublic ServletRequest getRequest() Description copied from class:javax.servlet.jsp.PageContextThe current value of the request object (a ServletRequest).- Specified by:
- getRequestin class- PageContext
- Returns:
- The ServletRequest for this PageContext
 
 - 
getResponsepublic ServletResponse getResponse() Description copied from class:javax.servlet.jsp.PageContextThe current value of the response object (a ServletResponse).- Specified by:
- getResponsein class- PageContext
- Returns:
- the ServletResponse for this PageContext
 
 - 
getExceptionpublic java.lang.Exception getException() Description copied from class:javax.servlet.jsp.PageContextThe current value of the exception object (an Exception).- Specified by:
- getExceptionin class- PageContext
- Returns:
- any exception passed to this as an errorpage
 
 - 
getServletConfigpublic ServletConfig getServletConfig() Description copied from class:javax.servlet.jsp.PageContextThe ServletConfig instance.- Specified by:
- getServletConfigin class- PageContext
- Returns:
- the ServletConfig for this PageContext
 
 - 
getServletContextpublic ServletContext getServletContext() Description copied from class:javax.servlet.jsp.PageContextThe ServletContext instance.- Specified by:
- getServletContextin class- PageContext
- Returns:
- the ServletContext for this PageContext
 
 - 
forwardpublic void forward(java.lang.String relativeUrlPath) throws ServletException, java.io.IOExceptionDescription copied from class:javax.servlet.jsp.PageContextThis 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 ServletContextfor 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 Threadexecuting within a_jspService(...)method of a JSP.Once this method has been called successfully, it is illegal for the calling Threadto attempt to modify theServletResponseobject. Any such attempt to do so, shall result in undefined behavior. Typically, callers immediately return from_jspService(...)after calling this method.- Specified by:
- forwardin class- PageContext
- Parameters:
- relativeUrlPath- specifies the relative URL path to the target resource as described above
- Throws:
- ServletException- if the page that was forwarded to throws a ServletException
- java.io.IOException- if an I/O error occurred while forwarding
 
 - 
includepublic void include(java.lang.String relativeUrlPath) throws ServletException, java.io.IOExceptionDescription copied from class:javax.servlet.jsp.PageContextCauses 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 ServletContextfor 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 Threadexecuting within a_jspService(...)method of a JSP.- Specified by:
- includein class- PageContext
- Parameters:
- relativeUrlPath- specifies the relative URL path to the target resource to be included
- Throws:
- ServletException- if the page that was forwarded to throws a ServletException
- java.io.IOException- if an I/O error occurred while forwarding
 
 - 
includepublic void include(java.lang.String relativeUrlPath, boolean flush) throws ServletException, java.io.IOExceptionDescription copied from class:javax.servlet.jsp.PageContextCauses 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 ServletContextfor 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 Threadexecuting within a_jspService(...)method of a JSP.- Specified by:
- includein class- PageContext
- Parameters:
- relativeUrlPath- specifies the relative URL path to the target resource to be included
- flush- True if the JspWriter is to be flushed before the include, or false if not.
- Throws:
- ServletException- if the page that was forwarded to throws a ServletException
- java.io.IOException- if an I/O error occurred while forwarding
 
 - 
getVariableResolver@Deprecated public VariableResolver getVariableResolver() Deprecated.Description copied from class:javax.servlet.jsp.JspContextReturns an instance of a VariableResolver that provides access to the implicit objects specified in the JSP specification using this JspContext as the context object.- Specified by:
- getVariableResolverin class- JspContext
- Returns:
- A valid instance of a VariableResolver.
 
 - 
pushBodypublic BodyContent pushBody() Description copied from class:javax.servlet.jsp.PageContextReturn 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.- Overrides:
- pushBodyin class- PageContext
- Returns:
- the new BodyContent
 
 - 
pushBodypublic JspWriter pushBody(java.io.Writer writer) Description copied from class:javax.servlet.jsp.JspContextReturn a new JspWriter object that sends output to the provided Writer. Saves the current "out" JspWriter, and updates the value of the "out" attribute in the page scope attribute namespace of the JspContext.The returned JspWriter must implement all methods and behave as though it were unbuffered. More specifically: - clear() must throw an IOException
- clearBuffer() does nothing
- getBufferSize() always returns 0
- getRemaining() always returns 0
 - Overrides:
- pushBodyin class- JspContext
- Parameters:
- writer- The Writer for the returned JspWriter to send output to.
- Returns:
- a new JspWriter that writes to the given Writer.
 
 - 
popBodypublic JspWriter popBody() Description copied from class:javax.servlet.jsp.JspContextReturn 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.- Overrides:
- popBodyin class- JspContext
- Returns:
- the saved JspWriter.
 
 - 
getExpressionEvaluator@Deprecated public ExpressionEvaluator getExpressionEvaluator() Deprecated.Description copied from class:javax.servlet.jsp.JspContextProvides programmatic access to the ExpressionEvaluator. The JSP Container must return a valid instance of an ExpressionEvaluator that can parse EL expressions.- Specified by:
- getExpressionEvaluatorin class- JspContext
- Returns:
- A valid instance of an ExpressionEvaluator.
 
 - 
handlePageExceptionpublic void handlePageException(java.lang.Exception ex) throws java.io.IOException, ServletExceptionDescription copied from class:javax.servlet.jsp.PageContextThis 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 compatibility reasons. Newly generated code should use PageContext.handlePageException(Throwable). - Specified by:
- handlePageExceptionin class- PageContext
- Parameters:
- ex- the exception to be handled
- Throws:
- java.io.IOException- if an I/O error occurred while invoking the error page
- ServletException- if an error occurs while invoking the error page
- See Also:
- PageContext.handlePageException(Throwable)
 
 - 
handlePageExceptionpublic void handlePageException(java.lang.Throwable t) throws java.io.IOException, ServletExceptionDescription copied from class:javax.servlet.jsp.PageContextThis 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. - Specified by:
- handlePageExceptionin class- PageContext
- Parameters:
- t- the throwable to be handled
- Throws:
- java.io.IOException- if an I/O error occurred while invoking the error page
- ServletException- if an error occurs while invoking the error page
- See Also:
- PageContext.handlePageException(Exception)
 
 - 
resolveVariable@Deprecated public java.lang.Object resolveVariable(java.lang.String pName) throws ELExceptionDeprecated.VariableResolver interface- Specified by:
- resolveVariablein interface- VariableResolver
- Parameters:
- pName- the name of the variable to resolve
- Returns:
- the result of the variable resolution
- Throws:
- ELException- if a failure occurred while trying to resolve the given variable
 
 - 
syncBeginTagFilepublic void syncBeginTagFile() Synchronize variables at begin of tag file
 - 
syncBeforeInvokepublic void syncBeforeInvoke() Synchronize variables before fragment invocation
 - 
syncEndTagFilepublic void syncEndTagFile() Synchronize variables at end of tag file
 - 
getELContextpublic ELContext getELContext() Description copied from class:javax.servlet.jsp.JspContextObtain the ELContext for this JSPContext. Each JSPContext has a dedicated ELContext.- Specified by:
- getELContextin class- JspContext
- Returns:
- the ELContext for this JSPContext
 
 
- 
 
-