public final class MockWebContext extends Object implements org.pac4j.core.context.WebContext
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
attributes |
protected String |
fullRequestURL |
protected Map<String,String> |
headers |
protected String |
ip |
protected String |
method |
protected Map<String,String> |
parameters |
protected String |
path |
protected Collection<org.pac4j.core.context.Cookie> |
requestCookies |
protected String |
responseContent |
protected String |
responseContentType |
protected Collection<org.pac4j.core.context.Cookie> |
responseCookies |
protected Map<String,String> |
responseHeaders |
protected int |
responseStatus |
protected String |
scheme |
protected boolean |
secure |
protected String |
serverName |
protected int |
serverPort |
protected Map<String,Object> |
session |
| Modifier | Constructor and Description |
|---|---|
protected |
MockWebContext() |
protected String method
protected String serverName
protected String scheme
protected boolean secure
protected int serverPort
protected String fullRequestURL
protected String ip
protected final Collection<org.pac4j.core.context.Cookie> requestCookies
protected String path
protected String responseContent
protected int responseStatus
protected String responseContentType
protected final Collection<org.pac4j.core.context.Cookie> responseCookies
public static MockWebContext create()
public MockWebContext addRequestParameters(Map<String,String> parameters)
parameters - parameterspublic MockWebContext addRequestParameter(String key, String value)
key - parameter namevalue - parameter valuepublic MockWebContext addRequestHeader(String key, String value)
key - request namevalue - request valuepublic MockWebContext addSessionAttribute(String name, Object value)
name - session attribute namevalue - session attribute valuepublic MockWebContext setRequestMethod(String method)
method - request methodpublic Object getRequestAttribute(String name)
getRequestAttribute in interface org.pac4j.core.context.WebContextpublic void setRequestAttribute(String name, Object value)
setRequestAttribute in interface org.pac4j.core.context.WebContextpublic String getRequestParameter(String name)
getRequestParameter in interface org.pac4j.core.context.WebContextpublic MockWebContext setRemoteAddress(String ip)
public String getRequestHeader(String name)
getRequestHeader in interface org.pac4j.core.context.WebContextpublic void setSessionAttribute(String name, Object value)
setSessionAttribute in interface org.pac4j.core.context.WebContextpublic Object getSessionAttribute(String name)
getSessionAttribute in interface org.pac4j.core.context.WebContextpublic Object getSessionIdentifier()
getSessionIdentifier in interface org.pac4j.core.context.WebContextpublic String getRequestMethod()
getRequestMethod in interface org.pac4j.core.context.WebContextpublic String getRemoteAddr()
getRemoteAddr in interface org.pac4j.core.context.WebContextpublic Map<String,String[]> getRequestParameters()
getRequestParameters in interface org.pac4j.core.context.WebContextpublic String getServerName()
getServerName in interface org.pac4j.core.context.WebContextpublic int getServerPort()
getServerPort in interface org.pac4j.core.context.WebContextpublic void setServerName(String serverName)
public void setServerPort(int serverPort)
public String getScheme()
getScheme in interface org.pac4j.core.context.WebContextpublic MockWebContext setScheme(String scheme)
public boolean isSecure()
isSecure in interface org.pac4j.core.context.WebContextpublic MockWebContext setSecure(boolean secure)
public String getFullRequestURL()
getFullRequestURL in interface org.pac4j.core.context.WebContextpublic MockWebContext setFullRequestURL(String fullRequestURL)
public Collection<org.pac4j.core.context.Cookie> getRequestCookies()
getRequestCookies in interface org.pac4j.core.context.WebContextpublic Collection<org.pac4j.core.context.Cookie> getResponseCookies()
public String getPath()
getPath in interface org.pac4j.core.context.WebContextpublic MockWebContext setPath(String path)
public void writeResponseContent(String content)
writeResponseContent in interface org.pac4j.core.context.WebContextpublic void setResponseStatus(int code)
setResponseStatus in interface org.pac4j.core.context.WebContextpublic void setResponseHeader(String name, String value)
setResponseHeader in interface org.pac4j.core.context.WebContextpublic String getResponseContent()
public int getResponseStatus()
public String getResponseLocation()
public void setResponseContentType(String content)
setResponseContentType in interface org.pac4j.core.context.WebContextpublic String getResponseContentType()
public void addResponseCookie(org.pac4j.core.context.Cookie cookie)
addResponseCookie in interface org.pac4j.core.context.WebContextCopyright © 2016. All Rights Reserved.