public class MockExternalContext
extends javax.faces.context.ExternalContext
Mock implementation of ExternalContext.
| Modifier and Type | Field and Description |
|---|---|
protected javax.servlet.ServletContext |
context |
protected javax.servlet.http.HttpServletRequest |
request |
protected javax.servlet.http.HttpServletResponse |
response |
| Constructor and Description |
|---|
MockExternalContext(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Construct a wrapper instance.
|
addResponseCookie, addResponseHeader, encodeBookmarkableURL, encodePartialActionURL, encodeRedirectURL, getApplicationContextPath, getClientWindow, getContextName, getFlash, getMimeType, getRealPath, getRequestCharacterEncoding, getRequestContentLength, getRequestContentType, getRequestScheme, getRequestServerName, getRequestServerPort, getResponseBufferSize, getResponseCharacterEncoding, getResponseContentType, getResponseOutputStream, getResponseOutputWriter, getSessionId, getSessionMaxInactiveInterval, invalidateSession, isResponseCommitted, isSecure, responseFlushBuffer, responseReset, responseSendError, setClientWindow, setRequest, setRequestCharacterEncoding, setResponse, setResponseBufferSize, setResponseCharacterEncoding, setResponseContentLength, setResponseContentType, setResponseHeader, setResponseStatus, setSessionMaxInactiveIntervalprotected javax.servlet.ServletContext context
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
public MockExternalContext(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Construct a wrapper instance.
context - ServletContext for this applicationrequest - HttpServetRequest for this requestresponse - HttpServletResponse for this requestpublic void addRequestCookieMap(javax.servlet.http.Cookie cookie)
Add a new cookie for this request.
cookie - The new cookiepublic void setRequestCookieMap(Map map)
Set the request cookie map for this request.
map - The new request cookie mappublic void addRequestParameterMap(String key, String value)
Add the specified request parameter for this request.
key - Parameter namevalue - Parameter valuepublic void setRequestParameterMap(Map map)
Set the request parameter map for this request.
map - The new request parameter mappublic void addRequestHeader(String key, String value)
Add the specified request header for this request.
key - Parameter namevalue - Parameter valuepublic void setRequestHeaderMap(Map map)
Set the request header map for this request.
map - The new request header mappublic void dispatch(String requestURI) throws IOException, javax.faces.FacesException
dispatch in class javax.faces.context.ExternalContextIOExceptionjavax.faces.FacesExceptionpublic String encodeActionURL(String sb)
encodeActionURL in class javax.faces.context.ExternalContextpublic String encodeNamespace(String aValue)
encodeNamespace in class javax.faces.context.ExternalContextpublic String encodeResourceURL(String sb)
encodeResourceURL in class javax.faces.context.ExternalContextpublic Map getApplicationMap()
getApplicationMap in class javax.faces.context.ExternalContextpublic String getAuthType()
getAuthType in class javax.faces.context.ExternalContextpublic Object getContext()
getContext in class javax.faces.context.ExternalContextpublic String getInitParameter(String name)
getInitParameter in class javax.faces.context.ExternalContextpublic Map getInitParameterMap()
getInitParameterMap in class javax.faces.context.ExternalContextpublic String getRemoteUser()
getRemoteUser in class javax.faces.context.ExternalContextpublic Object getRequest()
getRequest in class javax.faces.context.ExternalContextpublic String getRequestContextPath()
getRequestContextPath in class javax.faces.context.ExternalContextpublic Map getRequestCookieMap()
getRequestCookieMap in class javax.faces.context.ExternalContextpublic Map getRequestHeaderMap()
getRequestHeaderMap in class javax.faces.context.ExternalContextpublic Map getRequestHeaderValuesMap()
getRequestHeaderValuesMap in class javax.faces.context.ExternalContextpublic Locale getRequestLocale()
getRequestLocale in class javax.faces.context.ExternalContextpublic Iterator getRequestLocales()
getRequestLocales in class javax.faces.context.ExternalContextpublic Map getRequestMap()
getRequestMap in class javax.faces.context.ExternalContextpublic Map getRequestParameterMap()
getRequestParameterMap in class javax.faces.context.ExternalContextpublic Iterator getRequestParameterNames()
getRequestParameterNames in class javax.faces.context.ExternalContextpublic Map getRequestParameterValuesMap()
getRequestParameterValuesMap in class javax.faces.context.ExternalContextpublic String getRequestPathInfo()
getRequestPathInfo in class javax.faces.context.ExternalContextpublic String getRequestServletPath()
getRequestServletPath in class javax.faces.context.ExternalContextpublic URL getResource(String path) throws MalformedURLException
getResource in class javax.faces.context.ExternalContextMalformedURLExceptionpublic InputStream getResourceAsStream(String path)
getResourceAsStream in class javax.faces.context.ExternalContextpublic Set getResourcePaths(String path)
getResourcePaths in class javax.faces.context.ExternalContextpublic Object getResponse()
getResponse in class javax.faces.context.ExternalContextpublic Object getSession(boolean create)
getSession in class javax.faces.context.ExternalContextpublic Map getSessionMap()
getSessionMap in class javax.faces.context.ExternalContextpublic Principal getUserPrincipal()
getUserPrincipal in class javax.faces.context.ExternalContextpublic boolean isUserInRole(String role)
isUserInRole in class javax.faces.context.ExternalContextpublic void log(String message)
log in class javax.faces.context.ExternalContextpublic void log(String message, Throwable throwable)
log in class javax.faces.context.ExternalContextpublic void redirect(String requestURI) throws IOException
redirect in class javax.faces.context.ExternalContextIOExceptionCopyright © 2017 The Apache Software Foundation. All rights reserved.