public final class ExternalContextUtils extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static String | getCharacterEncoding(javax.faces.context.ExternalContext ec)Deprecated. 
 replaced by an API in JSF.  Use ExternalContext.getRequestCharacterEncoding() | 
| static int | getContentLength(javax.faces.context.ExternalContext ec)Returns the content length or -1 if the unknown. | 
| static String | getContentType(javax.faces.context.ExternalContext ec)Deprecated. 
 use ExternalContext.getRequestContentType() | 
| static String | getContextName(javax.faces.context.ExternalContext ec)Returns the name of the underlying context or  nullif something
 went wrong in trying to retrieve the context. | 
| static String | getRequestContextPath(javax.faces.context.ExternalContext ec)Deprecated. 
 use ExternalContext.getRequestContextPath() as of JSF 1.2.  This method
             does not appropriately handle portlet environments, but the functionality
             is maintained to prevent needing to change the contract. | 
| static String | getRequestedSessionId(javax.faces.context.ExternalContext ec)Returns the session ID for the client, or  nullif there is none. | 
| static InputStream | getRequestInputStream(javax.faces.context.ExternalContext ec)Returns the request input stream if one is available | 
| static String | getRequestScheme(javax.faces.context.ExternalContext ec)Deprecated. 
 replaced by ExternalContext.getRequestScheme(). | 
| static RequestType | getRequestType(javax.faces.context.ExternalContext ec)Returns the requestType of this ExternalContext. | 
| static String | getRequestURI(javax.faces.context.ExternalContext ec)Returns the requestURI of the HttpServletRequest or  nullfor
 portlet requests | 
| static Writer | getResponseWriter(javax.faces.context.ExternalContext ec)Deprecated. 
 replaced by an API in JSF.  Use ExternalContext.getResponseOutputWriter() | 
| static String | getServerInfo(javax.faces.context.ExternalContext ec)Returns the name and version of the underlying servlet container or  nullif something
 went wrong in trying to retrieve the context. | 
| static String | getServletContextPath(javax.faces.context.ExternalContext ec)Returns the contextPath of the ServletContext or  nullfor portlets | 
| static String | getSessionId(javax.faces.context.ExternalContext ec)Returns the current active session id or  nullif there is
 none. | 
| static String | getSessionId(javax.faces.context.ExternalContext ec,
            boolean create)Returns the current active session id or  nullif there is
 none. | 
| static boolean | isAction(javax.faces.context.ExternalContext ec)Deprecated. 
 replaced with  isRequestFromClient(ExternalContext) | 
| static boolean | isHttpServletRequest(javax.faces.context.ExternalContext ec)Returns wherther of not this external context represents a true HttpServletRequest or
 not. | 
| static boolean | isPortlet(javax.faces.context.ExternalContext ec)Returns the value of  RequestType.isPortlet()for the current
 RequestType. | 
| static boolean | isRequestedSessionIdValid(javax.faces.context.ExternalContext ec)Checks if the requested session ID is still valid. | 
| static boolean | isRequestFromClient(javax.faces.context.ExternalContext ec)Returns the value of  RequestType.isRequestFromClient()for the
 current RequestType. | 
| static boolean | isRequestTypeAvailable(RequestType type)Returns  trueif a particular class relating to the supplied
 request type is available on the current classpath orfalseif it is not. | 
| static boolean | isRequestTypeSupported(RequestType type)Returns  trueif a particular request type is supported by the
 container. | 
| static boolean | isResponseWritable(javax.faces.context.ExternalContext ec)Returns the value of  RequestType.isResponseWritable()for the
 current RequestType. | 
| static boolean | isSecure(javax.faces.context.ExternalContext ec)Provides access to  ServletRequest.isSecure()orPortletRequest.isSecure() | 
public static final boolean isRequestTypeAvailable(RequestType type)
true if a particular class relating to the supplied
 request type is available on the current classpath or false
 if it is not.  This class assumes that all containers have a servlet type
 request available, but the portlet request types are all dependant on the
 portlet container being used.type - the RequestType to testtrue if the container contains the
         request type in the classpathpublic static final boolean isRequestTypeSupported(RequestType type)
true if a particular request type is supported by the
 container.  For a request type to be supported, the required objects must
 be on the classpath AND and, in the case of Portlet RequestTypes, an
 appropriate bridge must be avaialble which supports those objects.  This
 means that if the supplied RequestType is RESOURCE, the
 javax.portlet.ResourceRequest object must be available on the classpath AND
 a bridge which supports the Portlet 2.0 specification would also need to be
 available.type - the RequestType to testtrue if the container supports the
         current request typepublic static final RequestType getRequestType(javax.faces.context.ExternalContext ec)
ec - the current external contextRequestTypepublic static String getSessionId(javax.faces.context.ExternalContext ec)
null if there is
 none.  If a session is not already created, this method will create one
 for you.ec - the current external contextpublic static String getSessionId(javax.faces.context.ExternalContext ec, boolean create)
null if there is
 none.ec - the current external contextcreate - create a new session if one is not createdpublic static String getRequestedSessionId(javax.faces.context.ExternalContext ec)
null if there is none.ec - the current external contextpublic static boolean isRequestedSessionIdValid(javax.faces.context.ExternalContext ec)
ec - the current external contexttrue if the request session is
         valid or false if it is notpublic static String getServletContextPath(javax.faces.context.ExternalContext ec)
null for portletsec - the current external context@Deprecated public static String getRequestContextPath(javax.faces.context.ExternalContext ec)
null for portlet requestsec - the current external contextExternalContext.getRequestContextPath()public static String getRequestURI(javax.faces.context.ExternalContext ec)
null for
 portlet requestsec - the current external context@Deprecated public static String getRequestScheme(javax.faces.context.ExternalContext ec)
ec - the current external context@Deprecated public static Writer getResponseWriter(javax.faces.context.ExternalContext ec) throws IOException
null if one is
 not available.  This will always be available in a servlet request, but will only be available
 for resource or render responses in a portal environmentsec - the current externalContextIOExceptionExternalContext.getResponseOutputWriter()@Deprecated public static String getCharacterEncoding(javax.faces.context.ExternalContext ec)
null if there isn't anyec - the current external contextExternalContext.getRequestCharacterEncoding()public static String getContextName(javax.faces.context.ExternalContext ec)
null if something
 went wrong in trying to retrieve the context.ec - the current external contextpublic static String getServerInfo(javax.faces.context.ExternalContext ec)
null if something
 went wrong in trying to retrieve the context.ec - the current external contextpublic static int getContentLength(javax.faces.context.ExternalContext ec)
ec - the current external context@Deprecated public static String getContentType(javax.faces.context.ExternalContext ec)
null if unknown.ec - the current external contextnullExternalContext.getRequestContentType()public static InputStream getRequestInputStream(javax.faces.context.ExternalContext ec) throws IOException
ec - the current external contextIOException - if there was a problem getting the input stream@Deprecated public static boolean isAction(javax.faces.context.ExternalContext ec)
isRequestFromClient(ExternalContext)true if this externalContext represents an "action".
 An action request is any ServletRequest or a portlet ActionRequest or
 ResourceRequest.ec - the current external contexttrue if this request is an action-type
         request.isRequestFromClient(ExternalContext)public static boolean isPortlet(javax.faces.context.ExternalContext ec)
RequestType.isPortlet() for the current
 RequestType. This is a convenience function designed to perform a quick
 check of the current request. If more capabilities need to be tested for
 the given request, then it is more efficient to pull this information from
 the RequestType itself.ec - the current external contexttrue if the current RequestType
         is a portlet request.RequestType.isPortlet(), 
getRequestType(ExternalContext)public static final boolean isResponseWritable(javax.faces.context.ExternalContext ec)
RequestType.isResponseWritable() for the
 current RequestType. This is a convenience function designed to perform a
 quick check of the current request. If more capabilities need to be tested
 for the given request, then it is more efficient to pull this information
 from the RequestType itself.ec - the current external contexttrue if the current RequestType
         is a "render" type response.RequestType.isResponseWritable(), 
getRequestType(ExternalContext)public static final boolean isRequestFromClient(javax.faces.context.ExternalContext ec)
RequestType.isRequestFromClient() for the
 current RequestType. This is a convenience function designed to perform a
 quick check of the current request. If more capabilities need to be tested
 for the given request, then it is more efficient to pull this information
 from the RequestType itself.ec - the current external contexttrue if the current RequestType
         represents a request from the client.RequestType.isResponseWritable(), 
getRequestType(ExternalContext)public static boolean isHttpServletRequest(javax.faces.context.ExternalContext ec)
ec - the current external contexttrue if the current request is an
         HttpServletRequestpublic static boolean isSecure(javax.faces.context.ExternalContext ec)
ServletRequest.isSecure() or PortletRequest.isSecure()ec - Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.