|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PageContext org.springframework.mock.web.MockPageContext
public class MockPageContext
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.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes
|
private JspWriter |
out
|
private HttpServletRequest |
request
|
private HttpServletResponse |
response
|
private ServletConfig |
servletConfig
|
private ServletContext |
servletContext
|
Constructor Summary | |
---|---|
MockPageContext()
Create new MockPageContext with a default MockServletContext ,
MockHttpServletRequest , MockHttpServletResponse ,
MockServletConfig . |
|
MockPageContext(ServletContext servletContext)
Create new MockPageContext with a default MockHttpServletRequest ,
MockHttpServletResponse , MockServletConfig . |
|
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. |
Method Summary | |
---|---|
java.lang.Object |
findAttribute(java.lang.String name)
|
void |
forward(java.lang.String path)
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
|
java.util.Enumeration<java.lang.String> |
getAttributeNamesInScope(int scope)
|
int |
getAttributesScope(java.lang.String name)
|
byte[] |
getContentAsByteArray()
|
java.lang.String |
getContentAsString()
|
ELContext |
getELContext()
|
java.lang.Exception |
getException()
|
ExpressionEvaluator |
getExpressionEvaluator()
|
JspWriter |
getOut()
|
java.lang.Object |
getPage()
|
ServletRequest |
getRequest()
|
ServletResponse |
getResponse()
|
ServletConfig |
getServletConfig()
|
ServletContext |
getServletContext()
|
HttpSession |
getSession()
|
VariableResolver |
getVariableResolver()
|
void |
handlePageException(java.lang.Exception ex)
|
void |
handlePageException(java.lang.Throwable ex)
|
void |
include(java.lang.String path)
|
void |
include(java.lang.String path,
boolean flush)
|
void |
initialize(Servlet servlet,
ServletRequest request,
ServletResponse response,
java.lang.String errorPageURL,
boolean needsSession,
int bufferSize,
boolean autoFlush)
|
void |
release()
|
void |
removeAttribute(java.lang.String name)
|
void |
removeAttribute(java.lang.String name,
int scope)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ServletContext servletContext
private final HttpServletRequest request
private final HttpServletResponse response
private final ServletConfig servletConfig
private final java.util.Map<java.lang.String,java.lang.Object> attributes
private JspWriter out
Constructor Detail |
---|
public MockPageContext()
MockServletContext
,
MockHttpServletRequest
, MockHttpServletResponse
,
MockServletConfig
.
public MockPageContext(ServletContext servletContext)
MockHttpServletRequest
,
MockHttpServletResponse
, MockServletConfig
.
servletContext
- the ServletContext that the JSP page runs in
(only necessary when actually accessing the ServletContext)public MockPageContext(ServletContext servletContext, HttpServletRequest request)
servletContext
- the ServletContext that the JSP page runs inrequest
- the current HttpServletRequest
(only necessary when actually accessing the request)public MockPageContext(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response)
servletContext
- the ServletContext that the JSP page runs inrequest
- the current HttpServletRequestresponse
- the current HttpServletResponse
(only necessary when actually writing to the response)public MockPageContext(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, ServletConfig servletConfig)
servletContext
- the ServletContext that the JSP page runs inrequest
- the current HttpServletRequestresponse
- the current HttpServletResponseservletConfig
- the ServletConfig (hardly ever accessed from within a tag)Method Detail |
---|
public void initialize(Servlet servlet, ServletRequest request, ServletResponse response, java.lang.String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush)
public void release()
public void setAttribute(java.lang.String name, java.lang.Object value)
public void setAttribute(java.lang.String name, java.lang.Object value, int scope)
public java.lang.Object getAttribute(java.lang.String name)
public java.lang.Object getAttribute(java.lang.String name, int scope)
public java.lang.Object findAttribute(java.lang.String name)
public void removeAttribute(java.lang.String name)
public void removeAttribute(java.lang.String name, int scope)
public int getAttributesScope(java.lang.String name)
public java.util.Enumeration<java.lang.String> getAttributeNames()
public java.util.Enumeration<java.lang.String> getAttributeNamesInScope(int scope)
public JspWriter getOut()
public ExpressionEvaluator getExpressionEvaluator()
public ELContext getELContext()
public VariableResolver getVariableResolver()
public HttpSession getSession()
public java.lang.Object getPage()
public ServletRequest getRequest()
public ServletResponse getResponse()
public java.lang.Exception getException()
public ServletConfig getServletConfig()
public ServletContext getServletContext()
public void forward(java.lang.String path) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public void include(java.lang.String path) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public void include(java.lang.String path, boolean flush) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public byte[] getContentAsByteArray()
public java.lang.String getContentAsString() throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void handlePageException(java.lang.Exception ex) throws ServletException, java.io.IOException
ServletException
java.io.IOException
public void handlePageException(java.lang.Throwable ex) throws ServletException, java.io.IOException
ServletException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |