spring-framework / org.springframework.mock.web / MockPageContext

MockPageContext

open class MockPageContext : PageContext

Mock implementation of the javax.servlet.jsp.PageContext interface. 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, or handlePageException calls.

Author
Juergen Hoeller

Since
1.0.2

Constructors

<init>

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, request: HttpServletRequest)

Create new MockPageContext with a MockHttpServletResponse, MockServletConfig.

MockPageContext(servletContext: ServletContext, request: HttpServletRequest, response: HttpServletResponse)

Create new MockPageContext with a MockServletConfig.

MockPageContext(servletContext: ServletContext, request: HttpServletRequest, response: HttpServletResponse, servletConfig: ServletConfig)

Create new MockServletConfig.

Functions

findAttribute

open fun findAttribute(name: String): Any

forward

open fun forward(path: String): Unit

getAttribute

open fun getAttribute(name: String): Any
open fun getAttribute(name: String, scope: Int): Any

getAttributeNames

open fun getAttributeNames(): Enumeration<String>

getAttributeNamesInScope

open fun getAttributeNamesInScope(scope: Int): Enumeration<String>

getAttributesScope

open fun getAttributesScope(name: String): Int

getContentAsByteArray

open fun getContentAsByteArray(): ByteArray

getContentAsString

open fun getContentAsString(): String

getELContext

open fun getELContext(): ELContext

getException

open fun getException(): Exception

getExpressionEvaluator

open fun getExpressionEvaluator(): ExpressionEvaluator

getOut

open fun getOut(): JspWriter

getPage

open fun getPage(): Any

getRequest

open fun getRequest(): ServletRequest

getResponse

open fun getResponse(): ServletResponse

getServletConfig

open fun getServletConfig(): ServletConfig

getServletContext

open fun getServletContext(): ServletContext

getSession

open fun getSession(): HttpSession

getVariableResolver

open fun getVariableResolver(): VariableResolver

handlePageException

open fun handlePageException(ex: Exception): Unit
open fun handlePageException(ex: Throwable): Unit

include

open fun include(path: String): Unit
open fun include(path: String, flush: Boolean): Unit

initialize

open fun initialize(servlet: Servlet, request: ServletRequest, response: ServletResponse, errorPageURL: String, needsSession: Boolean, bufferSize: Int, autoFlush: Boolean): Unit

release

open fun release(): Unit

removeAttribute

open fun removeAttribute(name: String): Unit
open fun removeAttribute(name: String, scope: Int): Unit

setAttribute

open fun setAttribute(name: String, value: Any): Unit
open fun setAttribute(name: String, value: Any, scope: Int): Unit