|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.faces.context.ExternalContext
org.jboss.jsfunit.context.JSFUnitExternalContext
public class JSFUnitExternalContext
The JSFUnitExternalContext is created at the end of the JSF lifecycle. It caches as much as possible from the "real" ExternalContext. Because the Servlet container is allowed to recycle request and response objects that the ExternalContext relies upon, a few methods could yield unexpected results. These methods are noted in the javadoc.
| Field Summary |
|---|
| Fields inherited from class javax.faces.context.ExternalContext |
|---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
|---|---|
JSFUnitExternalContext(ExternalContext delegate)
|
|
| Method Summary | |
|---|---|
void |
addResponseCookie(String name,
String value,
Map<String,Object> properties)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
addResponseHeader(String name,
String value)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
dispatch(String string)
Unsupported method. |
String |
encodeActionURL(String url)
Return the url unchanged. |
String |
encodeNamespace(String string)
|
String |
encodeResourceURL(String url)
Return the url unchanged. |
Map |
getApplicationMap()
Warning: The write-through capabilities of this Map are disabled for JSFUnit tests. |
String |
getAuthType()
|
Object |
getContext()
|
String |
getContextName()
|
String |
getInitParameter(String string)
|
Map |
getInitParameterMap()
|
String |
getMimeType(String file)
|
String |
getRealPath(String path)
|
String |
getRemoteUser()
|
Object |
getRequest()
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
String |
getRequestCharacterEncoding()
|
int |
getRequestContentLength()
|
String |
getRequestContentType()
|
String |
getRequestContextPath()
|
Map |
getRequestCookieMap()
|
Map |
getRequestHeaderMap()
|
Map |
getRequestHeaderValuesMap()
|
Locale |
getRequestLocale()
|
Iterator |
getRequestLocales()
|
Map |
getRequestMap()
|
Map |
getRequestParameterMap()
|
Iterator |
getRequestParameterNames()
|
Map |
getRequestParameterValuesMap()
|
String |
getRequestPathInfo()
|
String |
getRequestScheme()
|
String |
getRequestServerName()
|
int |
getRequestServerPort()
|
String |
getRequestServletPath()
|
URL |
getResource(String string)
|
InputStream |
getResourceAsStream(String string)
|
Set |
getResourcePaths(String string)
|
Object |
getResponse()
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
String |
getResponseCharacterEncoding()
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
String |
getResponseContentType()
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
OutputStream |
getResponseOutputStream()
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
Object |
getSession(boolean b)
|
Map |
getSessionMap()
Warning: The write-through capabilities of this Map are disabled for JSFUnit tests. |
Principal |
getUserPrincipal()
|
void |
invalidateSession()
|
boolean |
isUserInRole(String string)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
log(String string)
|
void |
log(String string,
Throwable throwable)
|
void |
redirect(String string)
Unsupported method. |
void |
setRequest(Object request)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setRequestCharacterEncoding(String encoding)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponse(Object response)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponseCharacterEncoding(String encoding)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponseContentType(String contentType)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponseHeader(String name,
String value)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JSFUnitExternalContext(ExternalContext delegate)
| Method Detail |
|---|
public Map getRequestCookieMap()
getRequestCookieMap in class ExternalContextpublic String getRequestContextPath()
getRequestContextPath in class ExternalContextpublic String getRemoteUser()
getRemoteUser in class ExternalContextpublic String getInitParameter(String string)
getInitParameter in class ExternalContextpublic Map getInitParameterMap()
getInitParameterMap in class ExternalContextpublic Object getContext()
getContext in class ExternalContextpublic String getAuthType()
getAuthType in class ExternalContextpublic Map getApplicationMap()
HttpSession session = (HttpSession)externalContext.getSession();
ServletContext appContext = session.getServletContext();
appContext.setAttribute("documentsByPath", "bar");
getApplicationMap in class ExternalContextpublic Map getRequestHeaderMap()
getRequestHeaderMap in class ExternalContextpublic Map getRequestHeaderValuesMap()
getRequestHeaderValuesMap in class ExternalContextpublic Locale getRequestLocale()
getRequestLocale in class ExternalContextpublic Iterator getRequestLocales()
getRequestLocales in class ExternalContextpublic Map getRequestMap()
getRequestMap in class ExternalContextpublic Map getRequestParameterMap()
getRequestParameterMap in class ExternalContextpublic Iterator getRequestParameterNames()
getRequestParameterNames in class ExternalContextpublic Map getRequestParameterValuesMap()
getRequestParameterValuesMap in class ExternalContextpublic String getRequestPathInfo()
getRequestPathInfo in class ExternalContextpublic String getRequestServletPath()
getRequestServletPath in class ExternalContextpublic Object getSession(boolean b)
getSession in class ExternalContextpublic Map getSessionMap()
HttpSession session = (HttpSession)externalContext.getSession();
session.setAttribute("documentsByPath", "bar");
getSessionMap in class ExternalContextpublic Principal getUserPrincipal()
getUserPrincipal in class ExternalContext
public URL getResource(String string)
throws MalformedURLException
getResource in class ExternalContextMalformedURLExceptionpublic InputStream getResourceAsStream(String string)
getResourceAsStream in class ExternalContextpublic Set getResourcePaths(String string)
getResourcePaths in class ExternalContext
public void log(String string,
Throwable throwable)
log in class ExternalContextpublic void log(String string)
log in class ExternalContextpublic String encodeNamespace(String string)
encodeNamespace in class ExternalContextpublic String encodeResourceURL(String url)
encodeResourceURL in class ExternalContexturl - The url to encode.
NullPointerException - if the url is nullpublic String encodeActionURL(String url)
encodeActionURL in class ExternalContexturl - The url to encode.
NullPointerException - if the url is null
public void addResponseCookie(String name,
String value,
Map<String,Object> properties)
public String getMimeType(String file)
public String getRealPath(String path)
public String getRequestCharacterEncoding()
public String getRequestContentType()
public String getRequestScheme()
public String getRequestServerName()
public int getRequestServerPort()
public String getResponseCharacterEncoding()
public String getResponseContentType()
public OutputStream getResponseOutputStream()
throws IOException
IOExceptionpublic void invalidateSession()
public void setRequest(Object request)
public void setRequestCharacterEncoding(String encoding)
throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic void setResponse(Object response)
public void setResponseCharacterEncoding(String encoding)
public void setResponseContentType(String contentType)
public String getContextName()
public int getRequestContentLength()
public void addResponseHeader(String name,
String value)
public void setResponseHeader(String name,
String value)
public boolean isUserInRole(String string)
isUserInRole in class ExternalContextpublic Object getResponse()
getResponse in class ExternalContextpublic Object getRequest()
getRequest in class ExternalContext
public void dispatch(String string)
throws IOException
dispatch in class ExternalContextUnsupportedOperationException - if this method is called during
a JSFUnit test.
IOException
public void redirect(String string)
throws IOException
redirect in class ExternalContextUnsupportedOperationException - if this method is called during
a JSFUnit test.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||