|
|||||||||
| Home >> All >> com >> mockobjects >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mockobjects.servlet
Class MockPageContext

java.lang.Objectjavax.servlet.jsp.JspContext
javax.servlet.jsp.PageContext
com.mockobjects.servlet.MockPageContext
- public class MockPageContext
- extends javax.servlet.jsp.PageContext
| Field Summary | |
private javax.servlet.http.HttpSession |
httpSession
|
private javax.servlet.jsp.JspWriter |
jspWriter
|
private javax.servlet.ServletRequest |
request
|
private javax.servlet.ServletContext |
servletContext
|
| 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 | |
MockPageContext()
|
|
| Method Summary | |
java.lang.Object |
findAttribute(java.lang.String s)
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 s)
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 s)
Returns the object associated with the name in the page scope or null if not found. |
java.lang.Object |
getAttribute(java.lang.String s,
int i)
Return the object associated with the name in the specified scope or null if not found. |
java.util.Enumeration |
getAttributeNamesInScope(int i)
Enumerate all the attributes in a given scope. |
int |
getAttributesScope(java.lang.String s)
Get the scope where a given attribute is defined. |
java.lang.Exception |
getException()
The current value of the exception object (an Exception). |
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). |
void |
handlePageException(java.lang.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. |
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 s)
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 servletRequest,
javax.servlet.ServletResponse servletResponse,
java.lang.String s,
boolean b,
int i,
boolean b2)
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. |
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 s)
Remove the object reference associated with the given name from all scopes. |
void |
removeAttribute(java.lang.String s,
int i)
Remove the object reference associated with the specified name in the given scope. |
void |
setAttribute(java.lang.String s,
java.lang.Object o)
Register the name and value specified with page scope semantics. |
void |
setAttribute(java.lang.String s,
java.lang.Object o,
int i)
Register the name and value specified with appropriate scope semantics. |
void |
setJspWriter(javax.servlet.jsp.JspWriter jspWriter)
|
void |
setRequest(javax.servlet.ServletRequest servletRequest)
|
void |
setServletContext(javax.servlet.ServletContext servletContext)
|
void |
setSession(javax.servlet.http.HttpSession httpSession)
|
void |
verify()
|
| Methods inherited from class javax.servlet.jsp.PageContext |
getErrorData, include, pushBody |
| Methods inherited from class javax.servlet.jsp.JspContext |
getExpressionEvaluator, getVariableResolver, popBody, pushBody |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
jspWriter
private javax.servlet.jsp.JspWriter jspWriter
request
private javax.servlet.ServletRequest request
httpSession
private javax.servlet.http.HttpSession httpSession
servletContext
private javax.servlet.ServletContext servletContext
| Constructor Detail |
MockPageContext
public MockPageContext()
| Method Detail |
release
public void release()
- Description copied from class:
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.
getOut
public javax.servlet.jsp.JspWriter getOut()
- Description copied from class:
javax.servlet.jsp.JspContext - The current value of the out object (a JspWriter).
setJspWriter
public void setJspWriter(javax.servlet.jsp.JspWriter jspWriter)
handlePageException
public void handlePageException(java.lang.Exception e)
- Description copied from class:
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).
getServletContext
public javax.servlet.ServletContext getServletContext()
- Description copied from class:
javax.servlet.jsp.PageContext - The ServletContext instance.
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
getAttributesScope
public int getAttributesScope(java.lang.String s)
- Description copied from class:
javax.servlet.jsp.JspContext - Get the scope where a given attribute is defined.
include
public void include(java.lang.String s)
- Description copied from class:
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
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.
removeAttribute
public void removeAttribute(java.lang.String s, int i)
- Description copied from class:
javax.servlet.jsp.JspContext - Remove the object reference associated with the specified name
in the given scope. Does nothing if there is no such object.
getAttributeNamesInScope
public java.util.Enumeration getAttributeNamesInScope(int i)
- Description copied from class:
javax.servlet.jsp.JspContext - Enumerate all the attributes in a given scope.
forward
public void forward(java.lang.String s)
- Description copied from class:
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
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.
getPage
public java.lang.Object getPage()
- Description copied from class:
javax.servlet.jsp.PageContext - The current value of the page object (In a Servlet environment,
this is an instance of javax.servlet.Servlet).
handlePageException
public void handlePageException(java.lang.Throwable t)
- Description copied from class:
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.
setRequest
public void setRequest(javax.servlet.ServletRequest servletRequest)
getRequest
public javax.servlet.ServletRequest getRequest()
- Description copied from class:
javax.servlet.jsp.PageContext - The current value of the request object (a ServletRequest).
getResponse
public javax.servlet.ServletResponse getResponse()
- Description copied from class:
javax.servlet.jsp.PageContext - The current value of the response object (a ServletResponse).
removeAttribute
public void removeAttribute(java.lang.String s)
- Description copied from class:
javax.servlet.jsp.JspContext - Remove the object reference associated with the given name
from all scopes. Does nothing if there is no such object.
getAttribute
public java.lang.Object getAttribute(java.lang.String s, int i)
- Description copied from class:
javax.servlet.jsp.JspContext - Return the object associated with the name in the specified
scope or null if not found.
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Description copied from class:
javax.servlet.jsp.PageContext - The ServletConfig instance.
initialize
public void initialize(javax.servlet.Servlet servlet, javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, java.lang.String s, boolean b, int i, boolean b2)
- Description copied from class:
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.
findAttribute
public java.lang.Object findAttribute(java.lang.String s)
- Description copied from class:
javax.servlet.jsp.JspContext - Searches for the named attribute in page, request, session (if valid),
and application scope(s) in order and returns the value associated or
null.
getSession
public javax.servlet.http.HttpSession getSession()
- Description copied from class:
javax.servlet.jsp.PageContext - The current value of the session object (an HttpSession).
setSession
public void setSession(javax.servlet.http.HttpSession httpSession)
setAttribute
public void setAttribute(java.lang.String s, java.lang.Object o)
- Description copied from class:
javax.servlet.jsp.JspContext - Register the name and value specified with page scope semantics.
If the value passed in is
null, this has the same effect as callingremoveAttribute( name, PageContext.PAGE_SCOPE ).
setAttribute
public void setAttribute(java.lang.String s, java.lang.Object o, int i)
- Description copied from class:
javax.servlet.jsp.JspContext - Register the name and value specified with appropriate
scope semantics. If the value passed in is
null, this has the same effect as callingremoveAttribute( name, scope ).
getAttribute
public java.lang.Object getAttribute(java.lang.String s)
- Description copied from class:
javax.servlet.jsp.JspContext - Returns the object associated with the name in the page scope or null
if not found.
getException
public java.lang.Exception getException()
- Description copied from class:
javax.servlet.jsp.PageContext - The current value of the exception object (an Exception).
verify
public void verify()
|
|||||||||
| Home >> All >> com >> mockobjects >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC