|
||||||||||
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.ExternalContext
public String getRequestContextPath()
getRequestContextPath
in class javax.faces.context.ExternalContext
public String getRemoteUser()
getRemoteUser
in class javax.faces.context.ExternalContext
public String getInitParameter(String string)
getInitParameter
in class javax.faces.context.ExternalContext
public Map getInitParameterMap()
getInitParameterMap
in class javax.faces.context.ExternalContext
public Object getContext()
getContext
in class javax.faces.context.ExternalContext
public String getAuthType()
getAuthType
in class javax.faces.context.ExternalContext
public Map getApplicationMap()
HttpSession session = (HttpSession)externalContext.getSession();
ServletContext appContext = session.getServletContext();
appContext.setAttribute("documentsByPath", "bar");
getApplicationMap
in class javax.faces.context.ExternalContext
public Map getRequestHeaderMap()
getRequestHeaderMap
in class javax.faces.context.ExternalContext
public Map getRequestHeaderValuesMap()
getRequestHeaderValuesMap
in class javax.faces.context.ExternalContext
public Locale getRequestLocale()
getRequestLocale
in class javax.faces.context.ExternalContext
public Iterator getRequestLocales()
getRequestLocales
in class javax.faces.context.ExternalContext
public Map getRequestMap()
getRequestMap
in class javax.faces.context.ExternalContext
public Map getRequestParameterMap()
getRequestParameterMap
in class javax.faces.context.ExternalContext
public Iterator getRequestParameterNames()
getRequestParameterNames
in class javax.faces.context.ExternalContext
public Map getRequestParameterValuesMap()
getRequestParameterValuesMap
in class javax.faces.context.ExternalContext
public String getRequestPathInfo()
getRequestPathInfo
in class javax.faces.context.ExternalContext
public String getRequestServletPath()
getRequestServletPath
in class javax.faces.context.ExternalContext
public Object getSession(boolean b)
getSession
in class javax.faces.context.ExternalContext
public Map getSessionMap()
HttpSession session = (HttpSession)externalContext.getSession();
session.setAttribute("documentsByPath", "bar");
getSessionMap
in class javax.faces.context.ExternalContext
public Principal getUserPrincipal()
getUserPrincipal
in class javax.faces.context.ExternalContext
public URL getResource(String string) throws MalformedURLException
getResource
in class javax.faces.context.ExternalContext
MalformedURLException
public InputStream getResourceAsStream(String string)
getResourceAsStream
in class javax.faces.context.ExternalContext
public Set getResourcePaths(String string)
getResourcePaths
in class javax.faces.context.ExternalContext
public void log(String string, Throwable throwable)
log
in class javax.faces.context.ExternalContext
public void log(String string)
log
in class javax.faces.context.ExternalContext
public String encodeNamespace(String string)
encodeNamespace
in class javax.faces.context.ExternalContext
public String encodeResourceURL(String url)
encodeResourceURL
in class javax.faces.context.ExternalContext
url
- The url to encode.
NullPointerException
- if the url is nullpublic String encodeActionURL(String url)
encodeActionURL
in class javax.faces.context.ExternalContext
url
- The url to encode.
NullPointerException
- if the url is nullpublic void addResponseCookie(String name, String value, Map<String,Object> properties)
addResponseCookie
in class javax.faces.context.ExternalContext
public String getMimeType(String file)
getMimeType
in class javax.faces.context.ExternalContext
public String getRealPath(String path)
getRealPath
in class javax.faces.context.ExternalContext
public String getRequestCharacterEncoding()
getRequestCharacterEncoding
in class javax.faces.context.ExternalContext
public String getRequestContentType()
getRequestContentType
in class javax.faces.context.ExternalContext
public String getRequestScheme()
getRequestScheme
in class javax.faces.context.ExternalContext
public String getRequestServerName()
getRequestServerName
in class javax.faces.context.ExternalContext
public int getRequestServerPort()
getRequestServerPort
in class javax.faces.context.ExternalContext
public String getResponseCharacterEncoding()
getResponseCharacterEncoding
in class javax.faces.context.ExternalContext
public String getResponseContentType()
getResponseContentType
in class javax.faces.context.ExternalContext
public OutputStream getResponseOutputStream() throws IOException
getResponseOutputStream
in class javax.faces.context.ExternalContext
IOException
public void invalidateSession()
invalidateSession
in class javax.faces.context.ExternalContext
public void setRequest(Object request)
setRequest
in class javax.faces.context.ExternalContext
public void setRequestCharacterEncoding(String encoding) throws UnsupportedEncodingException
setRequestCharacterEncoding
in class javax.faces.context.ExternalContext
UnsupportedEncodingException
public void setResponse(Object response)
setResponse
in class javax.faces.context.ExternalContext
public void setResponseCharacterEncoding(String encoding)
setResponseCharacterEncoding
in class javax.faces.context.ExternalContext
public void setResponseContentType(String contentType)
setResponseContentType
in class javax.faces.context.ExternalContext
public 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.ExternalContext
public 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.ExternalContext
public String getContextName()
getContextName
in class javax.faces.context.ExternalContext
public int getRequestContentLength()
getRequestContentLength
in class javax.faces.context.ExternalContext
public int getResponseBufferSize()
getResponseBufferSize
in class javax.faces.context.ExternalContext
public Writer getResponseOutputWriter() throws IOException
getResponseOutputWriter
in class javax.faces.context.ExternalContext
IOException
public boolean isResponseCommitted()
isResponseCommitted
in class javax.faces.context.ExternalContext
public void responseFlushBuffer() throws IOException
responseFlushBuffer
in class javax.faces.context.ExternalContext
IOException
public void responseReset()
responseReset
in class javax.faces.context.ExternalContext
public void responseSendError(int statusCode, String message) throws IOException
responseSendError
in class javax.faces.context.ExternalContext
IOException
public void setResponseBufferSize(int size)
setResponseBufferSize
in class javax.faces.context.ExternalContext
public void setResponseContentLength(int length)
setResponseContentLength
in class javax.faces.context.ExternalContext
public void setResponseHeader(String name, String value)
setResponseHeader
in class javax.faces.context.ExternalContext
public void setResponseStatus(int statusCode)
setResponseStatus
in class javax.faces.context.ExternalContext
public boolean isUserInRole(String string)
isUserInRole
in class javax.faces.context.ExternalContext
public Object getResponse()
getResponse
in class javax.faces.context.ExternalContext
public Object getRequest()
getRequest
in class javax.faces.context.ExternalContext
public void dispatch(String string) throws IOException
dispatch
in class javax.faces.context.ExternalContext
UnsupportedOperationException
- if this method is called during
a JSFUnit test.
IOException
public void redirect(String string) throws IOException
redirect
in class javax.faces.context.ExternalContext
UnsupportedOperationException
- 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 |