Java Doc for PageContext.java in  » Sevlet-Container » apache-tomcat-6.0.14 » javax » servlet » jsp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » apache tomcat 6.0.14 » javax.servlet.jsp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

All known Subclasses:   org.apache.jasper.runtime.JspContextWrapper,  org.apache.jasper.runtime.PageContextImpl,
PageContext
abstract public class PageContext extends JspContext (Code)

PageContext extends JspContext to provide useful context information for when JSP technology is used in a Servlet environment.

A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several page attributes, as well as a layer above the implementation details. Implicit objects are added to the pageContext automatically.

The PageContext class is an abstract class, designed to be extended to provide implementation dependent implementations thereof, by conformant JSP engine runtime environments. A PageContext instance is obtained by a JSP implementation class by calling the JspFactory.getPageContext() method, and is released by calling JspFactory.releasePageContext().

An example of how PageContext, JspFactory, and other classes can be used within a JSP Page Implementation object is given elsewhere.

The PageContext provides a number of facilities to the page/component author and page implementor, including:

  • a single API to manage the various scoped namespaces
  • a number of convenience API's to access various public objects
  • a mechanism to obtain the JspWriter for output
  • a mechanism to manage session usage by the page
  • a mechanism to expose page directive attributes to the scripting environment
  • mechanisms to forward or include the current request to other active components in the application
  • a mechanism to handle errorpage exception processing

Methods Intended for Container Generated Code

Some methods are intended to be used by the code generated by the container, not by code written by JSP page authors, or JSP tag library authors.

The methods supporting lifecycle are initialize() and release()

The following methods enable the management of nested JspWriter streams to implement Tag Extensions: pushBody()

Methods Intended for JSP authors

The following methods provide convenient access to implicit objects: getException(), getPage() getRequest(), getResponse(), getSession(), getServletConfig() and getServletContext().

The following methods provide support for forwarding, inclusion and error handling: forward(), include(), and handlePageException().



Field Summary
final public static  StringAPPLICATION
     Name used to store ServletContext in PageContext name table.
final public static  intAPPLICATION_SCOPE
     Application scope: named reference remains available in the ServletContext until it is reclaimed.
final public static  StringCONFIG
     Name used to store ServletConfig in PageContext name table.
final public static  StringEXCEPTION
     Name used to store uncaught exception in ServletRequest attribute list and PageContext name table.
final public static  StringOUT
     Name used to store current JspWriter in PageContext name table.
final public static  StringPAGE
     Name used to store the Servlet in this PageContext's nametables.
final public static  StringPAGECONTEXT
     Name used to store this PageContext in it's own name table.
final public static  intPAGE_SCOPE
     Page scope: (this is the default) the named reference remains available in this PageContext until the return from the current Servlet.service() invocation.
final public static  StringREQUEST
     Name used to store ServletRequest in PageContext name table.
final public static  intREQUEST_SCOPE
     Request scope: the named reference remains available from the ServletRequest associated with the Servlet until the current request is completed.
final public static  StringRESPONSE
     Name used to store ServletResponse in PageContext name table.
final public static  StringSESSION
     Name used to store HttpSession in PageContext name table.
final public static  intSESSION_SCOPE
     Session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated.

Constructor Summary
public  PageContext()
     Sole constructor.

Method Summary
abstract public  voidforward(String relativeUrlPath)
    

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.

public  ErrorDatagetErrorData()
     Provides convenient access to error information. an ErrorData instance containing information about the error, as obtained from the request attributes, as per the Servlet specification.
abstract public  ExceptiongetException()
     The current value of the exception object (an Exception).
abstract public  ObjectgetPage()
     The current value of the page object (In a Servlet environment, this is an instance of javax.servlet.Servlet).
abstract public  ServletRequestgetRequest()
     The current value of the request object (a ServletRequest).
abstract public  ServletResponsegetResponse()
     The current value of the response object (a ServletResponse).
abstract public  ServletConfiggetServletConfig()
     The ServletConfig instance.
abstract public  ServletContextgetServletContext()
     The ServletContext instance.
abstract public  HttpSessiongetSession()
     The current value of the session object (an HttpSession).
abstract public  voidhandlePageException(Exception e)
    

This method is intended to process an unhandled 'page' level exception by forwarding the exception to the specified error page for this JSP.

abstract public  voidhandlePageException(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.

abstract public  voidinclude(String relativeUrlPath)
    

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.

abstract public  voidinclude(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. 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.

abstract public  voidinitialize(Servlet servlet, ServletRequest request, ServletResponse response, 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.

public  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.
abstract public  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().


Field Detail
APPLICATION
final public static String APPLICATION(Code)
Name used to store ServletContext in PageContext name table.



APPLICATION_SCOPE
final public static int APPLICATION_SCOPE(Code)
Application scope: named reference remains available in the ServletContext until it is reclaimed.



CONFIG
final public static String CONFIG(Code)
Name used to store ServletConfig in PageContext name table.



EXCEPTION
final public static String EXCEPTION(Code)
Name used to store uncaught exception in ServletRequest attribute list and PageContext name table.



OUT
final public static String OUT(Code)
Name used to store current JspWriter in PageContext name table.



PAGE
final public static String PAGE(Code)
Name used to store the Servlet in this PageContext's nametables.



PAGECONTEXT
final public static String PAGECONTEXT(Code)
Name used to store this PageContext in it's own name table.



PAGE_SCOPE
final public static int PAGE_SCOPE(Code)
Page scope: (this is the default) the named reference remains available in this PageContext until the return from the current Servlet.service() invocation.



REQUEST
final public static String REQUEST(Code)
Name used to store ServletRequest in PageContext name table.



REQUEST_SCOPE
final public static int REQUEST_SCOPE(Code)
Request scope: the named reference remains available from the ServletRequest associated with the Servlet until the current request is completed.



RESPONSE
final public static String RESPONSE(Code)
Name used to store ServletResponse in PageContext name table.



SESSION
final public static String SESSION(Code)
Name used to store HttpSession in PageContext name table.



SESSION_SCOPE
final public static int SESSION_SCOPE(Code)
Session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated.




Constructor Detail
PageContext
public PageContext()(Code)
Sole constructor. (For invocation by subclass constructors, typically implicit.)




Method Detail
forward
abstract public void forward(String relativeUrlPath) throws ServletException, IOException(Code)

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.


Parameters:
  relativeUrlPath - specifies the relative URL path to the target resource as described above
throws:
  IllegalStateException - if ServletResponse is not in a state where a forward can be performed
throws:
  ServletException - if the page that was forwarded to throwsa ServletException
throws:
  IOException - if an I/O error occurred while forwarding



getErrorData
public ErrorData getErrorData()(Code)
Provides convenient access to error information. an ErrorData instance containing information about the error, as obtained from the request attributes, as per the Servlet specification. If this is not an error page (that is,if the isErrorPage attribute of the page directive is not setto "true"), the information is meaningless.
since:
   2.0



getException
abstract public Exception getException()(Code)
The current value of the exception object (an Exception). any exception passed to this as an errorpage



getPage
abstract public Object getPage()(Code)
The current value of the page object (In a Servlet environment, this is an instance of javax.servlet.Servlet). the Page implementation class instance associated with this PageContext



getRequest
abstract public ServletRequest getRequest()(Code)
The current value of the request object (a ServletRequest). The ServletRequest for this PageContext



getResponse
abstract public ServletResponse getResponse()(Code)
The current value of the response object (a ServletResponse). the ServletResponse for this PageContext



getServletConfig
abstract public ServletConfig getServletConfig()(Code)
The ServletConfig instance. the ServletConfig for this PageContext



getServletContext
abstract public ServletContext getServletContext()(Code)
The ServletContext instance. the ServletContext for this PageContext



getSession
abstract public HttpSession getSession()(Code)
The current value of the session object (an HttpSession). the HttpSession for this PageContext or null



handlePageException
abstract public void handlePageException(Exception e) throws ServletException, IOException(Code)

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).
Parameters:
  e - the exception to be handled
throws:
  ServletException - if an error occurs while invoking the error page
throws:
  IOException - if an I/O error occurred while invoking the errorpage
throws:
  NullPointerException - if the exception is null
See Also:   PageContext.handlePageException(Throwable)




handlePageException
abstract public void handlePageException(Throwable t) throws ServletException, IOException(Code)

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.
Parameters:
  t - the throwable to be handled
throws:
  ServletException - if an error occurs while invoking the error page
throws:
  IOException - if an I/O error occurred while invoking the errorpage
throws:
  NullPointerException - if the exception is null
See Also:   PageContext.handlePageException(Exception)




include
abstract public void include(String relativeUrlPath) throws ServletException, IOException(Code)

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.


Parameters:
  relativeUrlPath - specifies the relative URL path to the target resource to be included
throws:
  ServletException - if the page that was forwarded to throwsa ServletException
throws:
  IOException - if an I/O error occurred while forwarding



include
abstract public void include(String relativeUrlPath, boolean flush) throws ServletException, IOException(Code)

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.


Parameters:
  relativeUrlPath - specifies the relative URL path to the target resource to be included
Parameters:
  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 throwsa ServletException
throws:
  IOException - if an I/O error occurred while forwarding
since:
   2.0



initialize
abstract public void initialize(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) throws IOException, IllegalStateException, IllegalArgumentException(Code)

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.
Parameters:
  servlet - The Servlet that is associated with this PageContext
Parameters:
  request - The currently pending request for this Servlet
Parameters:
  response - The currently pending response for this Servlet
Parameters:
  errorPageURL - The value of the errorpage attribute from the page directive or null
Parameters:
  needsSession - The value of the session attribute from the page directive
Parameters:
  bufferSize - The value of the buffer attribute from the page directive
Parameters:
  autoFlush - The value of the autoflush attribute from the page directive
throws:
  IOException - during creation of JspWriter
throws:
  IllegalStateException - if out not correctly initialized
throws:
  IllegalArgumentException - If one of the given parametersis invalid




pushBody
public BodyContent pushBody()(Code)
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. the new BodyContent



release
abstract public void release()(Code)

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.




Methods inherited from javax.servlet.jsp.JspContext
abstract public Object findAttribute(String name)(Code)(Java Doc)
abstract public Object getAttribute(String name)(Code)(Java Doc)
abstract public Object getAttribute(String name, int scope)(Code)(Java Doc)
abstract public Enumeration<String> getAttributeNamesInScope(int scope)(Code)(Java Doc)
abstract public int getAttributesScope(String name)(Code)(Java Doc)
abstract public ELContext getELContext()(Code)(Java Doc)
abstract public ExpressionEvaluator getExpressionEvaluator()(Code)(Java Doc)
abstract public JspWriter getOut()(Code)(Java Doc)
abstract public VariableResolver getVariableResolver()(Code)(Java Doc)
public JspWriter popBody()(Code)(Java Doc)
public JspWriter pushBody(java.io.Writer writer)(Code)(Java Doc)
abstract public void removeAttribute(String name)(Code)(Java Doc)
abstract public void removeAttribute(String name, int scope)(Code)(Java Doc)
abstract public void setAttribute(String name, Object value)(Code)(Java Doc)
abstract public void setAttribute(String name, Object value, int scope)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.