Class Overview
Mock implementation of the javax.servlet.jsp.PageContext interface.
Used for testing the web framework; only necessary for testing applications
when testing custom JSP tags.
Note: Expects initialization via the constructor rather than via the
PageContext.initialize
method. Does not support writing to a
JspWriter, request dispatching, and handlePageException
calls.
Summary
Public Constructors |
|
MockPageContext()
|
|
MockPageContext(ServletContext servletContext)
|
|
MockPageContext(ServletContext servletContext, HttpServletRequest request)
Create new MockPageContext with a MockHttpServletResponse,
MockServletConfig.
|
|
MockPageContext(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response)
Create new MockPageContext with a MockServletConfig.
|
|
MockPageContext(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ServletConfig servletConfig)
Create new MockServletConfig.
|
Public Methods |
Object
|
findAttribute(String name)
|
void
|
forward(String url)
|
Object
|
getAttribute(String name)
|
Object
|
getAttribute(String name, int scope)
|
Enumeration<String>
|
getAttributeNames()
|
Enumeration<String>
|
getAttributeNamesInScope(int scope)
|
int
|
getAttributesScope(String name)
|
ELContext
|
getELContext()
|
Exception
|
getException()
|
ExpressionEvaluator
|
getExpressionEvaluator()
|
JspWriter
|
getOut()
|
Object
|
getPage()
|
ServletRequest
|
getRequest()
|
ServletResponse
|
getResponse()
|
ServletConfig
|
getServletConfig()
|
ServletContext
|
getServletContext()
|
HttpSession
|
getSession()
|
VariableResolver
|
getVariableResolver()
|
void
|
handlePageException(Exception ex)
|
void
|
handlePageException(Throwable ex)
|
void
|
include(String url, boolean flush)
|
void
|
include(String url)
|
void
|
initialize(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush)
|
void
|
release()
|
void
|
removeAttribute(String name, int scope)
|
void
|
removeAttribute(String name)
|
void
|
setAttribute(String name, Object value, int scope)
|
void
|
setAttribute(String name, Object value)
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Public Constructors
public
MockPageContext
()
public
MockPageContext
(ServletContext servletContext)
Parameters
servletContext
| the ServletContext that the JSP page runs in (only
necessary when actually accessing the ServletContext)
|
public
MockPageContext
(ServletContext servletContext, HttpServletRequest request)
Create new MockPageContext with a MockHttpServletResponse,
MockServletConfig.
Parameters
servletContext
| the ServletContext that the JSP page runs in |
request
| the current HttpServletRequest (only necessary when
actually accessing the request)
|
public
MockPageContext
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response)
Create new MockPageContext with a MockServletConfig.
Parameters
servletContext
| the ServletContext that the JSP page runs in |
request
| the current HttpServletRequest |
response
| the current HttpServletResponse (only necessary when
actually writing to the response)
|
public
MockPageContext
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ServletConfig servletConfig)
Create new MockServletConfig.
Parameters
servletContext
| the ServletContext that the JSP page runs in |
request
| the current HttpServletRequest |
response
| the current HttpServletResponse |
servletConfig
| the ServletConfig (hardly ever accessed from within
a tag)
|
Public Methods
public
void
forward
(String url)
public
int
getAttributesScope
(String name)
public
ELContext
getELContext
()
public
ExpressionEvaluator
getExpressionEvaluator
()
public
JspWriter
getOut
()
public
ServletRequest
getRequest
()
public
ServletResponse
getResponse
()
public
ServletConfig
getServletConfig
()
public
ServletContext
getServletContext
()
public
HttpSession
getSession
()
public
VariableResolver
getVariableResolver
()
public
void
handlePageException
(Exception ex)
public
void
handlePageException
(Throwable ex)
public
void
include
(String url, boolean flush)
public
void
include
(String url)
public
void
initialize
(Servlet servlet, ServletRequest request, ServletResponse response, String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush)
public
void
removeAttribute
(String name, int scope)
public
void
removeAttribute
(String name)
public
void
setAttribute
(String name, Object value, int scope)