public class ServletEnvironment extends Environment
| Constructor and Description |
|---|
ServletEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCachedLocale()
If the enviroment caches the locale, it should implement this method to clear the cached locale
value.
|
void |
dispatch(java.lang.String requestURI)
Dispatch a request to the specified resource to create output
for this response.
|
java.lang.String |
encodeResourceURL(java.lang.String url)
Return the input URL, after performing any rewriting needed to
ensure that it will correctly identify an addressable resource in the
current application.
|
java.lang.Object |
getContext()
Return the application environment object instance for the current
appication.
|
java.lang.Object |
getRequest()
Return the environment-specific object instance for the current
request.
|
java.lang.String |
getRequestCharacterEncoding() |
java.lang.String |
getRequestContextPath()
Return the portion of the request URI that identifies the web
application context for this request.
|
java.util.Locale |
getRequestLocale()
Return the preferred
Locale in which the client
will accept content. |
java.util.Map |
getRequestParameterMap() |
java.lang.String |
getRequestPathInfo()
Return the extra path information (if any) included in the
request URI; otherwise, return
null. |
java.lang.String |
getRequestQueryString() |
java.lang.String |
getRequestServletPath()
Return the servlet path information (if any) included in the
request URI; otherwise, return
null. |
java.lang.String |
getRequestURI() |
java.lang.Object |
getResponse()
Return the environment-specific object instance for the current
response.
|
java.lang.Object |
getSession() |
void |
redirect(java.lang.String url)
Redirect a request to the specified URL, and cause the
responseComplete() method to be called on the
FacesContext instance for the current request. |
void |
setRequestCharacterEncoding(java.lang.String encoding) |
getContextObject, setFacesEnvironmentpublic ServletEnvironment(javax.servlet.ServletContext servletContext,
javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
public java.lang.Object getRequest()
EnvironmentReturn the environment-specific object instance for the current request.
Servlet: This must be the current request's
javax.servlet.http.HttpServletRequest instance.
Portlet: This must be the current request's
javax.portlet.PortletRequest instance, which
will be either an ActionRequest or a
RenderRequest depending upon when this method
is called.
getRequest in class Environmentpublic java.lang.Object getSession()
public java.lang.Object getResponse()
EnvironmentReturn the environment-specific object instance for the current response.
Servlet: This is the current request's
javax.servlet.http.HttpServletResponse instance.
Portlet: This is the current request's
javax.portlet.PortletResponse instance, which
will be either an ActionResponse or a
RenderResponse depending upon when this method
is called.
getResponse in class Environmentpublic java.lang.Object getContext()
EnvironmentReturn the application environment object instance for the current appication.
Servlet: This must be the current application's
javax.servlet.ServletContext instance.
Portlet: This must be the current application's
javax.portlet.PortletContext instance.
getContext in class Environmentpublic java.util.Locale getRequestLocale()
EnvironmentReturn the preferred Locale in which the client
will accept content.
Servlet: This must be the value returned by the
javax.servlet.ServletRequest method
getLocale().
Portlet: This must be the value returned by the
javax.portlet.PortletRequest method
getLocale().
getRequestLocale in class Environmentpublic void clearCachedLocale()
EnvironmentclearCachedLocale in class Environmentpublic java.lang.String getRequestServletPath()
EnvironmentReturn the servlet path information (if any) included in the
request URI; otherwise, return null.
Servlet: This must be the value returned by the
javax.servlet.http.HttpServletRequest method
getServletPath().
Portlet: This must be null.
getRequestServletPath in class Environmentpublic java.lang.String getRequestPathInfo()
EnvironmentReturn the extra path information (if any) included in the
request URI; otherwise, return null.
Servlet: This must be the value returned by the
javax.servlet.http.HttpServletRequest method
getPathInfo().
Portlet: This must be null.
getRequestPathInfo in class Environmentpublic java.lang.String encodeResourceURL(java.lang.String url)
EnvironmentReturn the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable resource in the current application.
Servlet: This must be the value returned by the
javax.servlet.http.HttpServletResponse method
encodeURL(url).
Portlet: This must be the value returned by the
javax.portlet.PortletResponse method
encodeURL(url).
encodeResourceURL in class Environmenturl - The input URL to be encodedpublic void redirect(java.lang.String url)
throws java.io.IOException
EnvironmentRedirect a request to the specified URL, and cause the
responseComplete() method to be called on the
FacesContext instance for the current request.
Servlet: This must be accomplished by calling the
javax.servlet.http.HttpServletResponse method
sendRedirect().
Portlet: This must be accomplished by calling the
javax.portlet.ActionResponse method
sendRedirect().
redirect in class Environmenturl - Absolute URL to which the client should be redirectedjava.io.IOException - if an input/output error occurspublic java.lang.String getRequestContextPath()
EnvironmentReturn the portion of the request URI that identifies the web application context for this request.
Servlet: This must be the value returned by the
javax.servlet.http.HttpServletRequest method
getContextPath().
Portlet: This must be the value returned by the
javax.portlet.PortletRequest method
getContextPath().
getRequestContextPath in class Environmentpublic java.lang.String getRequestURI()
getRequestURI in class Environmentpublic java.lang.String getRequestQueryString()
getRequestQueryString in class Environmentpublic java.lang.String getRequestCharacterEncoding()
getRequestCharacterEncoding in class Environmentpublic void setRequestCharacterEncoding(java.lang.String encoding)
throws java.io.IOException
setRequestCharacterEncoding in class Environmentjava.io.IOExceptionpublic java.util.Map getRequestParameterMap()
getRequestParameterMap in class Environmentpublic void dispatch(java.lang.String requestURI)
throws java.io.IOException
EnvironmentDispatch a request to the specified resource to create output for this response.
Servlet: This must be accomplished by calling the
javax.servlet.ServletContext method
getRequestDispatcher(path), and calling the
forward() method on the resulting object.
Portlet: This must be accomplished by calling the
javax.portlet.PortletContext method
getRequestDispatcher(), and calling the
include() method on the resulting object.
dispatch in class EnvironmentrequestURI - Context relative path to the specified resource,
which must start with a slash ("/") characterjava.io.IOException - if an input/output error occurs