Package org.apache.myfaces.util
Class ExternalContextUtils
java.lang.Object
org.apache.myfaces.util.ExternalContextUtils
This provides some functionality for determining some things about the
 native request object that is not provided by Faces.  This class is useful
 for use in places where Portlet API's may or may not be present and can
 also provide access to some request-specific items which are not available on
 the Faces ExternalContext.  If portlet API's are not present, this class simply 
 handles the Servlet Request type.
- 
Method SummaryModifier and TypeMethodDescriptionstatic jakarta.servlet.http.HttpServletRequestReturns an HttpServletRequest if one exists on the externalContext or null if it does not.static jakarta.servlet.http.HttpServletResponseReturns an HttpServletResponse if one exists on the externalContext or null if it does not.static jakarta.servlet.http.HttpServletResponsegetHttpServletResponse(Object response) Trys to obtain a HttpServletResponse from the Response.static booleanReturns wherther of not this external context represents a true HttpServletRequest or not.static booleanThis is a convenience function designed to perform a quick check of the currentExternalContext.
- 
Method Details- 
isPortletThis is a convenience function designed to perform a quick check of the currentExternalContext.- Parameters:
- ec- the current external context
- Returns:
- trueif the current- ExternalContextis a Porlet.
 
- 
isHttpServletRequestReturns wherther of not this external context represents a true HttpServletRequest or not. Some portal containers implement the PortletRequest/Response objects as HttpServletRequestWrappers, and those objects should not be treated as an HttpServlerRequest. As such, this method first tests to see if the request is a portlet request and, if not, then tests to see if the request is an instanceof HttpServletRequest.- Parameters:
- ec- the current external context
- Returns:
- a boolean value of trueif the current request is an HttpServletRequest
 
- 
getHttpServletResponseReturns an HttpServletResponse if one exists on the externalContext or null if it does not. Please note that some portal environments implement the PortletRequest and Response objects as HttpServletRequest/Response objects. This method handles these types of requests properly and will therefore return null in portal environments.- Parameters:
- ec-
- Returns:
- an HttpServletResponse if we have one or null if we do not
 
- 
getHttpServletRequestReturns an HttpServletRequest if one exists on the externalContext or null if it does not. Please note that some portal environments implement the PortletRequest and Response objects as HttpServletRequest/Response objects. This method handles these types of requests properly and will therefore return null in portal environments.- Parameters:
- ec-
- Returns:
- an HttpServletResponse if we have one or null if we do not
 
- 
getHttpServletResponseTrys to obtain a HttpServletResponse from the Response. Note that this method also trys to unwrap any ServletResponseWrapper in order to retrieve a valid HttpServletResponse.- Parameters:
- response-
- Returns:
- if found, the HttpServletResponse, null otherwise
 
 
-