|
||||||||||
| 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(javax.faces.context.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)
|
void |
dispatch(String string)
Unsupported method. |
String |
encodeActionURL(String url)
Return the url unchanged. |
String |
encodeBookmarkableURL(String baseUrl,
Map<String,List<String>> parameters)
|
String |
encodeNamespace(String string)
|
String |
encodePartialActionURL(String url)
|
String |
encodeRedirectURL(String baseUrl,
Map<String,List<String>> parameters)
|
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()
|
javax.faces.context.Flash |
getFlash()
|
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. |
int |
getResponseBufferSize()
|
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. |
Writer |
getResponseOutputWriter()
|
Object |
getSession(boolean b)
|
Map |
getSessionMap()
Warning: The write-through capabilities of this Map are disabled for JSFUnit tests. |
Principal |
getUserPrincipal()
|
void |
invalidateSession()
|
boolean |
isResponseCommitted()
|
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 |
responseFlushBuffer()
|
void |
responseReset()
|
void |
responseSendError(int statusCode,
String message)
|
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 |
setResponseBufferSize(int size)
|
void |
setResponseCharacterEncoding(String encoding)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponseContentLength(int length)
|
void |
setResponseContentType(String contentType)
Warning: Calling this method from a JSFUnit test could yield unexpected results. |
void |
setResponseHeader(String name,
String value)
|
void |
setResponseStatus(int statusCode)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JSFUnitExternalContext(javax.faces.context.ExternalContext delegate)
| Method Detail |
|---|
public Map getRequestCookieMap()
getRequestCookieMap in class javax.faces.context.ExternalContextpublic String getRequestContextPath()
getRequestContextPath in class javax.faces.context.ExternalContextpublic String getRemoteUser()
getRemoteUser in class javax.faces.context.ExternalContextpublic String getInitParameter(String string)
getInitParameter in class javax.faces.context.ExternalContextpublic Map getInitParameterMap()
getInitParameterMap in class javax.faces.context.ExternalContextpublic Object getContext()
getContext in class javax.faces.context.ExternalContextpublic String getAuthType()
getAuthType in class javax.faces.context.ExternalContextpublic Map getApplicationMap()
HttpSession session = (HttpSession)externalContext.getSession();
ServletContext appContext = session.getServletContext();
appContext.setAttribute("documentsByPath", "bar");
getApplicationMap 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 Object getSession(boolean b)
getSession in class javax.faces.context.ExternalContextpublic Map getSessionMap()
HttpSession session = (HttpSession)externalContext.getSession();
session.setAttribute("documentsByPath", "bar");
getSessionMap in class javax.faces.context.ExternalContextpublic Principal getUserPrincipal()
getUserPrincipal in class javax.faces.context.ExternalContext
public URL getResource(String string)
throws MalformedURLException
getResource in class javax.faces.context.ExternalContextMalformedURLExceptionpublic InputStream getResourceAsStream(String string)
getResourceAsStream in class javax.faces.context.ExternalContextpublic Set getResourcePaths(String string)
getResourcePaths in class javax.faces.context.ExternalContext
public void log(String string,
Throwable throwable)
log in class javax.faces.context.ExternalContextpublic void log(String string)
log in class javax.faces.context.ExternalContextpublic String encodeNamespace(String string)
encodeNamespace in class javax.faces.context.ExternalContextpublic String encodeResourceURL(String url)
encodeResourceURL in class javax.faces.context.ExternalContexturl - The url to encode.
NullPointerException - if the url is nullpublic String encodeActionURL(String url)
encodeActionURL in class javax.faces.context.ExternalContexturl - The url to encode.
NullPointerException - if the url is null
public void addResponseCookie(String name,
String value,
Map<String,Object> properties)
addResponseCookie in class javax.faces.context.ExternalContextpublic String getMimeType(String file)
getMimeType in class javax.faces.context.ExternalContextpublic String getRealPath(String path)
getRealPath in class javax.faces.context.ExternalContextpublic String getRequestCharacterEncoding()
getRequestCharacterEncoding in class javax.faces.context.ExternalContextpublic String getRequestContentType()
getRequestContentType in class javax.faces.context.ExternalContextpublic String getRequestScheme()
getRequestScheme in class javax.faces.context.ExternalContextpublic String getRequestServerName()
getRequestServerName in class javax.faces.context.ExternalContextpublic int getRequestServerPort()
getRequestServerPort in class javax.faces.context.ExternalContextpublic String getResponseCharacterEncoding()
getResponseCharacterEncoding in class javax.faces.context.ExternalContextpublic String getResponseContentType()
getResponseContentType in class javax.faces.context.ExternalContext
public OutputStream getResponseOutputStream()
throws IOException
getResponseOutputStream in class javax.faces.context.ExternalContextIOExceptionpublic void invalidateSession()
invalidateSession in class javax.faces.context.ExternalContextpublic void setRequest(Object request)
setRequest in class javax.faces.context.ExternalContext
public void setRequestCharacterEncoding(String encoding)
throws UnsupportedEncodingException
setRequestCharacterEncoding in class javax.faces.context.ExternalContextUnsupportedEncodingExceptionpublic void setResponse(Object response)
setResponse in class javax.faces.context.ExternalContextpublic void setResponseCharacterEncoding(String encoding)
setResponseCharacterEncoding in class javax.faces.context.ExternalContextpublic void setResponseContentType(String contentType)
setResponseContentType in class javax.faces.context.ExternalContextpublic javax.faces.context.Flash getFlash()
getFlash in class javax.faces.context.ExternalContext
public void addResponseHeader(String name,
String value)
addResponseHeader in class javax.faces.context.ExternalContext
public String encodeBookmarkableURL(String baseUrl,
Map<String,List<String>> parameters)
encodeBookmarkableURL in class javax.faces.context.ExternalContextpublic String encodePartialActionURL(String url)
encodePartialActionURL in class javax.faces.context.ExternalContext
public String encodeRedirectURL(String baseUrl,
Map<String,List<String>> parameters)
encodeRedirectURL in class javax.faces.context.ExternalContextpublic String getContextName()
getContextName in class javax.faces.context.ExternalContextpublic int getRequestContentLength()
getRequestContentLength in class javax.faces.context.ExternalContextpublic int getResponseBufferSize()
getResponseBufferSize in class javax.faces.context.ExternalContext
public Writer getResponseOutputWriter()
throws IOException
getResponseOutputWriter in class javax.faces.context.ExternalContextIOExceptionpublic boolean isResponseCommitted()
isResponseCommitted in class javax.faces.context.ExternalContext
public void responseFlushBuffer()
throws IOException
responseFlushBuffer in class javax.faces.context.ExternalContextIOExceptionpublic void responseReset()
responseReset in class javax.faces.context.ExternalContext
public void responseSendError(int statusCode,
String message)
throws IOException
responseSendError in class javax.faces.context.ExternalContextIOExceptionpublic void setResponseBufferSize(int size)
setResponseBufferSize in class javax.faces.context.ExternalContextpublic void setResponseContentLength(int length)
setResponseContentLength in class javax.faces.context.ExternalContext
public void setResponseHeader(String name,
String value)
setResponseHeader in class javax.faces.context.ExternalContextpublic void setResponseStatus(int statusCode)
setResponseStatus in class javax.faces.context.ExternalContextpublic boolean isUserInRole(String string)
isUserInRole in class javax.faces.context.ExternalContextpublic Object getResponse()
getResponse in class javax.faces.context.ExternalContextpublic Object getRequest()
getRequest in class javax.faces.context.ExternalContext
public void dispatch(String string)
throws IOException
dispatch in class javax.faces.context.ExternalContextUnsupportedOperationException - if this method is called during
a JSFUnit test.
IOException
public void redirect(String string)
throws IOException
redirect in class javax.faces.context.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 | |||||||||