Class ExternalContextImpl

    • Constructor Detail

      • ExternalContextImpl

        public ExternalContextImpl​(jakarta.servlet.ServletContext sc,
                                   jakarta.servlet.ServletRequest request,
                                   jakarta.servlet.ServletResponse response)
    • Method Detail

      • getSession

        public Object getSession​(boolean create)
        Description copied from class: ExternalContext

        If the create parameter is true, create (if necessary) and return a session instance associated with the current request. If the create parameter is false return any existing session instance associated with the current request, or return null if there is no such session.

        Jakarta Servlet: This must return the result of calling getSession(create) on the underlying jakarta.servlet.http.HttpServletRequest instance.

        Specified by:
        getSession in class ExternalContext
        Parameters:
        create - Flag indicating whether or not a new session should be created if there is no session associated with the current request
        Returns:
        the session object of the current request.
        See Also:
        ExternalContext.getSession(boolean)
      • getSessionId

        public String getSessionId​(boolean create)
        Description copied from class: ExternalContext

        Return the id of the current session or the empty string if no session has been created and the create parameter is false.

        Jakarta Servlet: If create is true, obtain a reference to the HttpSession for the current request (creating the session if necessary) and return its id. If create is false, obtain a reference to the current session, if one exists, and return its id. If no session exists, return the empty string.

        Overrides:
        getSessionId in class ExternalContext
        Parameters:
        create - Flag indicating whether or not a new session should be created if there is no session associated with the current request
        Returns:
        the session id for the current request.
      • getContext

        public Object getContext()
        Description copied from class: ExternalContext

        Return the application environment object instance for the current appication.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this returns the same container context instance (ServletContext or PortletContext) as the one returned when calling getContext() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the current application's jakarta.servlet.ServletContext instance.

        Specified by:
        getContext in class ExternalContext
        Returns:
        the object of the ServletContext.
        See Also:
        ExternalContext.getContext()
      • getContextName

        public String getContextName()
        Description copied from class: ExternalContext

        Return the name of the container context for this application.

        Return the result of calling getServletContextName() on the ServletContext instance for this application. It is valid to call this method during application startup or shutdown.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getContextName in class ExternalContext
        Returns:
        the name the ServletContext.
        See Also:
        ExternalContext.getContextName()
      • getRequest

        public Object getRequest()
        Description copied from class: ExternalContext

        Return the environment-specific object instance for the current request.

        Jakarta Servlet: This must be the current request's jakarta.servlet.http.HttpServletRequest instance.

        Specified by:
        getRequest in class ExternalContext
        Returns:
        the instance of the current request.
        See Also:
        ExternalContext.getRequest()
      • setRequest

        public void setRequest​(Object request)
        Description copied from class: ExternalContext

        Set the environment-specific request to be returned by subsequent calls to ExternalContext.getRequest(). This may be used to install a wrapper for the request.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setRequest in class ExternalContext
        Parameters:
        request - the request object to be set.
        See Also:
        ExternalContext.setRequest(Object)
      • setRequestCharacterEncoding

        public void setRequestCharacterEncoding​(String encoding)
                                         throws UnsupportedEncodingException
        Description copied from class: ExternalContext

        Overrides the name of the character encoding used in the body of this request.

        Calling this method after the request has been accessed will have no no effect, unless a Reader or Stream has been obtained from the request, in which case an IllegalStateException is thrown.

        Jakarta Servlet: This must call through to the jakarta.servlet.ServletRequest method setCharacterEncoding().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setRequestCharacterEncoding in class ExternalContext
        Parameters:
        encoding - the encoding name to be set.
        Throws:
        UnsupportedEncodingException - if this is not a valid encoding
        See Also:
        ExternalContext.setRequestCharacterEncoding(String)
      • getResponse

        public Object getResponse()
        Description copied from class: ExternalContext

        Return the environment-specific object instance for the current response.

        Jakarta Servlet: This is the current request's jakarta.servlet.http.HttpServletResponse instance.

        Specified by:
        getResponse in class ExternalContext
        Returns:
        the instance of the current jakarta.servlet.http.HttpServletResponse.
        See Also:
        ExternalContext.getResponse()
      • setResponse

        public void setResponse​(Object response)
        Description copied from class: ExternalContext

        Set the environment-specific response to be returned by subsequent calls to ExternalContext.getResponse(). This may be used to install a wrapper for the response.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponse in class ExternalContext
        Parameters:
        response - the response instance to be set.
        See Also:
        ExternalContext.setResponse(Object)
      • setResponseCharacterEncoding

        public void setResponseCharacterEncoding​(String encoding)
        Description copied from class: ExternalContext

        Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8.

        Jakarta Servlet: This must call through to the jakarta.servlet.ServletResponse method setCharacterEncoding().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseCharacterEncoding in class ExternalContext
        Parameters:
        encoding - the character encoding to be sent by the current response.
        See Also:
        ExternalContext.setResponseCharacterEncoding(String)
      • getApplicationMap

        public Map<String,​Object> getApplicationMap()
        Description copied from class: ExternalContext

        Return a mutable Map representing the application scope attributes for the current application. The returned Map must implement the entire contract for a modifiable map as described in the JavaDocs for java.util.Map. Modifications made in the Map must cause the corresponding changes in the set of application scope attributes. Particularly the clear(), remove(), put(), putAll(), and get() operations must take the appropriate action on the underlying data structure.

        It is valid to call this method during application startup or shutdown. If called at startup or shutdown time, this method returns a Map that is backed by the same container context instance (ServletContext or PortletContext) as the one returned by calling getApplicationMap() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the set of attributes available via the jakarta.servlet.ServletContext methods getAttribute(), getAttributeNames(), removeAttribute(), and setAttribute().

        Specified by:
        getApplicationMap in class ExternalContext
        Returns:
        the map associated with the backed ServletContext.
        See Also:
        ExternalContext.getApplicationMap()
      • getApplicationContextPath

        public String getApplicationContextPath()
        Description copied from class: ExternalContext

        Return the name of the container context for this application.

        Jakarta Servlet: Return the result of calling getContextPath() on the ServletContext instance for this application.

        It is valid to call this method during application startup or shutdown.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getApplicationContextPath in class ExternalContext
        Returns:
        the context path of this application.
      • getSessionMap

        public Map<String,​Object> getSessionMap()
        Description copied from class: ExternalContext

        Return a mutable Map representing the session scope attributes for the current application. The returned Map must implement the entire contract for a modifiable map as described in the JavaDocs for java.util.Map. Modifications made in the Map must cause the corresponding changes in the set of session scope attributes. Particularly the clear(), remove(), put(), and get() operations must take the appropriate action on the underlying data structure. Accessing attributes via this Map must cause the creation of a session associated with the current request, if such a session does not already exist.

        Jakarta Servlet: This must be the set of attributes available via the jakarta.servlet.http.HttpSession methods getAttribute(), getAttributeNames(), removeAttribute(), and setAttribute().

        Specified by:
        getSessionMap in class ExternalContext
        Returns:
        the session map for the current application.
        See Also:
        ExternalContext.getSessionMap()
      • getRequestMap

        public Map<String,​Object> getRequestMap()
        Description copied from class: ExternalContext

        Return a mutable Map representing the request scope attributes for the current application. The returned Map must implement the entire contract for a modifiable map as described in the JavaDocs for java.util.Map. Modifications made in the Map must cause the corresponding changes in the set of request scope attributes. Particularly the clear(), remove(), put(), putAll(), and get() operations must take the appropriate action on the underlying data structure.

        Jakarta Servlet: This must be the set of attributes available via the jakarta.servlet.ServletRequest methods getAttribute(), getAttributeNames(), removeAttribute(), and setAttribute().

        Specified by:
        getRequestMap in class ExternalContext
        Returns:
        the map including the attributes of the current request.
        See Also:
        ExternalContext.getRequestMap()
      • getRequestHeaderMap

        public Map<String,​String> getRequestHeaderMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of request header names included in the current request, and whose values (of type String) are the first (or only) value for each header name returned by the underlying request. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map. In addition, key comparisons must be performed in a case insensitive manner.

        Jakarta Servlet: This must be the set of headers available via the jakarta.servlet.http.HttpServletRequest methods getHeader() and getHeaderNames().

        Specified by:
        getRequestHeaderMap in class ExternalContext
        Returns:
        the header map in the current request.
        See Also:
        ExternalContext.getRequestHeaderMap()
      • getRequestHeaderValuesMap

        public Map<String,​String[]> getRequestHeaderValuesMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of request header names included in the current request, and whose values (of type String[]) are all of the value for each header name returned by the underlying request. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map. In addition, key comparisons must be performed in a case insensitive manner.

        Jakarta Servlet: This must be the set of headers available via the jakarta.servlet.http.HttpServletRequest methods getHeaders() and getHeaderNames().

        Specified by:
        getRequestHeaderValuesMap in class ExternalContext
        Returns:
        the header values map in the current request.
        See Also:
        ExternalContext.getRequestHeaderValuesMap()
      • getRequestCookieMap

        public Map<String,​Object> getRequestCookieMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of cookie names included in the current request, and whose values (of type jakarta.servlet.http.Cookie) are the first (or only) cookie for each cookie name returned by the underlying request. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getCookies(), unless null was returned, in which case this must be a zero-length array.

        Specified by:
        getRequestCookieMap in class ExternalContext
        Returns:
        the cookie map in the current request.
        See Also:
        ExternalContext.getRequestCookieMap()
      • getInitParameterMap

        public Map<String,​String> getInitParameterMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of application initialization parameter names configured for this application, and whose values are the corresponding parameter values. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method returns a Map that is backed by the same container context instance (ServletContext or PortletContext) as the one returned by calling getInitParameterMap() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This result must be as if it were synthesized by calling the jakarta.servlet.ServletContext method getInitParameterNames, and putting each configured parameter name/value pair into the result.

        Specified by:
        getInitParameterMap in class ExternalContext
        Returns:
        the init parameter map for this application.
        See Also:
        ExternalContext.getInitParameterMap()
      • getRequestParameterMap

        public Map<String,​String> getRequestParameterMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of request parameters names included in the current request, and whose values (of type String) are the first (or only) value for each parameter name returned by the underlying request. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map.

        Jakarta Servlet: This must be the set of parameters available via the jakarta.servlet.ServletRequest methods getParameter() and getParameterNames().

        Specified by:
        getRequestParameterMap in class ExternalContext
        Returns:
        the map for the current request parameters.
        See Also:
        ExternalContext.getRequestParameterMap()
      • getRequestParameterValuesMap

        public Map<String,​String[]> getRequestParameterValuesMap()
        Description copied from class: ExternalContext

        Return an immutable Map whose keys are the set of request parameters names included in the current request, and whose values (of type String[]) are all of the values for each parameter name returned by the underlying request. The returned Map must implement the entire contract for an unmodifiable map as described in the JavaDocs for java.util.Map.

        Jakarta Servlet: This must be the set of parameters available via the jakarta.servlet.ServletRequest methods getParameterValues() and getParameterNames().

        Specified by:
        getRequestParameterValuesMap in class ExternalContext
        Returns:
        the map for the parameter values of the current request.
        See Also:
        ExternalContext.getRequestParameterValuesMap()
      • getRequestLocales

        public Iterator<Locale> getRequestLocales()
        Description copied from class: ExternalContext

        Return an Iterator over the preferred Locales specified in the request, in decreasing order of preference.

        Jakarta Servlet: This must be an Iterator over the values returned by the jakarta.servlet.ServletRequest method getLocales().

        Specified by:
        getRequestLocales in class ExternalContext
        Returns:
        the Iterator of Locales of the current request.
        See Also:
        ExternalContext.getRequestLocales()
      • getRequestPathInfo

        public String getRequestPathInfo()
        Description copied from class: ExternalContext

        Return the extra path information (if any) included in the request URI; otherwise, return null.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getPathInfo().

        Specified by:
        getRequestPathInfo in class ExternalContext
        Returns:
        the path information of the current request.
        See Also:
        ExternalContext.getRequestPathInfo()
      • getRealPath

        public String getRealPath​(String path)
        Description copied from class: ExternalContext

        Returns a String containing the real path for a given virtual path.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the getRealPath() method on the same container context instance (ServletContext or PortletContext) as the one used when calling getRealPath() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletContext method getRealPath().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRealPath in class ExternalContext
        Parameters:
        path - The context of the requested initialization parameter
        Returns:
        the real path for the specified virtual path.
        See Also:
        ExternalContext.getRealPath(String)
      • getRequestContextPath

        public String getRequestContextPath()
        Description copied from class: ExternalContext

        Return the portion of the request URI that identifies the web application context for this request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getContextPath().

        Specified by:
        getRequestContextPath in class ExternalContext
        Returns:
        the context path for this request.
        See Also:
        ExternalContext.getRequestContextPath()
      • getRequestServletPath

        public String getRequestServletPath()
        Description copied from class: ExternalContext

        Return the Jakarta Servlet path information (if any) included in the request URI; otherwise, return null.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getServletPath().

        Specified by:
        getRequestServletPath in class ExternalContext
        Returns:
        the Jakarta Servlet path information of the current request.
        See Also:
        ExternalContext.getRequestServletPath()
      • getRequestCharacterEncoding

        public String getRequestCharacterEncoding()
        Description copied from class: ExternalContext

        Return the character encoding currently being used to interpret this request.

        Jakarta Servlet: This must return the value returned by the jakarta.servlet.ServletRequest method getCharacterEncoding().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestCharacterEncoding in class ExternalContext
        Returns:
        the character encoding currently being used.
        See Also:
        ExternalContext.getRequestCharacterEncoding()
      • getRequestContentType

        public String getRequestContentType()
        Description copied from class: ExternalContext

        Return the MIME Content-Type for this request. If not available, return null.

        Jakarta Servlet: This must return the value returned by the jakarta.servlet.ServletRequest method getContentType().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestContentType in class ExternalContext
        Returns:
        the Content-Type for this request.
        See Also:
        ExternalContext.getRequestContentType()
      • getRequestContentLength

        public int getRequestContentLength()
        Description copied from class: ExternalContext

        Return the result of calling getContentLenth() on the ServletRequest instance for this request.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestContentLength in class ExternalContext
        Returns:
        the content length of the current request.
        See Also:
        ExternalContext.getRequestContentLength()
      • getResponseCharacterEncoding

        public String getResponseCharacterEncoding()
        Description copied from class: ExternalContext

        Returns the name of the character encoding (MIME charset) used for the body sent in this response.

        Jakarta Servlet: This must return the value returned by the jakarta.servlet.ServletResponse method getCharacterEncoding().

        Portlet: if this method is called during a lifecycle phase other than RENDER_RESPONSE, this must return null. If called during RENDER_RESPONSE, return the response encoding of the portlet response.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getResponseCharacterEncoding in class ExternalContext
        Returns:
        the name of the character encoding.
        See Also:
        ExternalContext.getResponseCharacterEncoding()
      • getResponseContentType

        public String getResponseContentType()
        Description copied from class: ExternalContext

        Return the MIME Content-Type for this response. If not available, return null.

        Jakarta Servlet: This must return the value returned by the jakarta.servlet.ServletResponse method getContentType().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getResponseContentType in class ExternalContext
        Returns:
        the MIME Content-Type for this response.
        See Also:
        ExternalContext.getResponseContentType()
      • getInitParameter

        public String getInitParameter​(String name)
        Description copied from class: ExternalContext

        Return the value of the specified application initialization parameter (if any).

        Jakarta Servlet: This must be the result of the jakarta.servlet.ServletContext method getInitParameter(name).

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the actual container context to return the init parameter value.

        Specified by:
        getInitParameter in class ExternalContext
        Parameters:
        name - Name of the requested initialization parameter
        Returns:
        the value of the specified parameter.
        See Also:
        ExternalContext.getInitParameter(String)
      • getResourcePaths

        public Set<String> getResourcePaths​(String path)
        Description copied from class: ExternalContext

        Return the Set of resource paths for all application resources whose resource path starts with the specified argument.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the getResourcePaths() method on the same container context instance (ServletContext or PortletContext) as the one used when calling getResourcePaths() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletContext method getResourcePaths(path).

        Specified by:
        getResourcePaths in class ExternalContext
        Parameters:
        path - Partial path used to match resources, which must start with a slash ("/") character
        Returns:
        the Set of resource paths for the application resources.
        See Also:
        ExternalContext.getResourcePaths(String)
      • getResourceAsStream

        public InputStream getResourceAsStream​(String path)
        Description copied from class: ExternalContext

        Return an InputStream for an application resource mapped to the specified path, if it exists; otherwise, return null.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the getResourceAsStream() method on the same container context instance (ServletContext or PortletContext) as the one used when calling getResourceAsStream() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletContext method getResourceAsStream(path).

        Specified by:
        getResourceAsStream in class ExternalContext
        Parameters:
        path - The path to the requested resource, which must start with a slash ("/" character
        Returns:
        the InputStream for the application resource.
        See Also:
        ExternalContext.getResourceAsStream(String)
      • getResource

        public URL getResource​(String path)
        Description copied from class: ExternalContext

        Return a URL for the application resource mapped to the specified path, if it exists; otherwise, return null.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the getResource() method on the same container context instance (ServletContext or PortletContext) as the one used when calling getResource() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletContext method getResource(path).

        Specified by:
        getResource in class ExternalContext
        Parameters:
        path - The path to the requested resource, which must start with a slash ("/" character
        Returns:
        the URL of the resource.
        See Also:
        ExternalContext.getResource(String)
      • encodeResourceURL

        public String encodeResourceURL​(String url)
        Description copied from class: ExternalContext

        Return the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable resource in the current application.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletResponse method encodeURL(url).

        Specified by:
        encodeResourceURL in class ExternalContext
        Parameters:
        url - The input URL to be encoded
        Returns:
        the encoded resource URL.
        See Also:
        ExternalContext.encodeResourceURL(String)
      • encodeNamespace

        public String encodeNamespace​(String name)
        Description copied from class: ExternalContext

        Return the specified name, after prefixing it with a namespace that ensures that it will be unique within the context of a particular page.

        Jakarta Servlet: The input value must be returned unchanged.

        Specified by:
        encodeNamespace in class ExternalContext
        Parameters:
        name - Name to be encoded
        Returns:
        the unique name prefixed with namespace.
        See Also:
        ExternalContext.encodeNamespace(String)
      • dispatch

        public void dispatch​(String requestURI)
                      throws IOException,
                             FacesException
        Description copied from class: ExternalContext

        Dispatch a request to the specified resource to create output for this response.

        Jakarta Servlet: This must be accomplished by calling the jakarta.servlet.ServletContext method getRequestDispatcher(path), and calling the forward() method on the resulting object.

        If the call to getRequestDisatcher(path) returns null, send aServletResponse SC_NOT_FOUND error code.

        Specified by:
        dispatch in class ExternalContext
        Parameters:
        requestURI - Context relative path to the specified resource, which must start with a slash ("/") character
        Throws:
        IOException - if an input/output error occurs
        FacesException - thrown if a ServletException occurs
        See Also:
        ExternalContext.dispatch(String)
      • log

        public void log​(String message)
        Description copied from class: ExternalContext

        Log the specified message to the application object.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this calls the log() method on the same container context instance (ServletContext or PortletContext) as the one used during a call to log() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.ServletContext method log(String).

        Specified by:
        log in class ExternalContext
        Parameters:
        message - Message to be logged
        See Also:
        ExternalContext.log(String)
      • log

        public void log​(String message,
                        Throwable throwable)
        Description copied from class: ExternalContext

        Log the specified message and exception to the application object.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this calls the log() method on the same container context instance (ServletContext or PortletContext) as the one used when calling log() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.ServletContext method log(String,Throwable).

        Specified by:
        log in class ExternalContext
        Parameters:
        message - Message to be logged
        throwable - Exception to be logged
        See Also:
        ExternalContext.log(String, Throwable)
      • getAuthType

        public String getAuthType()
        Description copied from class: ExternalContext

        Return the name of the authentication scheme used to authenticate the current user, if any; otherwise, return null. For standard authentication schemes, the returned value will match one of the following constants: BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, or FORM_AUTH.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getAuthType().

        Specified by:
        getAuthType in class ExternalContext
        Returns:
        the authentication type.
        See Also:
        ExternalContext.getAuthType()
      • getMimeType

        public String getMimeType​(String file)
        Description copied from class: ExternalContext

        Returns the MIME type of the specified file or null if the MIME type is not known. The MIME type is determined by the container.

        It is valid to call this method during application startup or shutdown. If called during application startup or shutdown, this method calls through to the getMimeType() method on the same container context instance (ServletContext or PortletContext) as the one used when calling getMimeType() on the ExternalContext returned by the FacesContext during an actual request.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletContext method getMimeType().

        Overrides:
        getMimeType in class ExternalContext
        Parameters:
        file - The file for which the mime type should be obtained.
        Returns:
        the MIME type of the file.
        See Also:
        ExternalContext.getMimeType(String)
      • getRemoteUser

        public String getRemoteUser()
        Description copied from class: ExternalContext

        Return the login name of the user making the current request if any; otherwise, return null.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getRemoteUser().

        Specified by:
        getRemoteUser in class ExternalContext
        Returns:
        the user name of the current request.
        See Also:
        ExternalContext.getRemoteUser()
      • getUserPrincipal

        public Principal getUserPrincipal()
        Description copied from class: ExternalContext

        Return the Principal object containing the name of the current authenticated user, if any; otherwise, return null.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method getUserPrincipal().

        Specified by:
        getUserPrincipal in class ExternalContext
        Returns:
        the Principal object.
        See Also:
        ExternalContext.getUserPrincipal()
      • isUserInRole

        public boolean isUserInRole​(String role)
        Description copied from class: ExternalContext

        Return true if the currently authenticated user is included in the specified role. Otherwise, return false.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpServletRequest method isUserInRole(role).

        Specified by:
        isUserInRole in class ExternalContext
        Parameters:
        role - Logical role name to be checked
        Returns:
        the flag indicating whether the current user is in the specified role.
        See Also:
        ExternalContext.isUserInRole(String)
      • invalidateSession

        public void invalidateSession()
        Description copied from class: ExternalContext

        Invalidates this session then unbinds any objects bound to it.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.http.HttpSession method invalidate().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        invalidateSession in class ExternalContext
        See Also:
        ExternalContext.invalidateSession()
      • addResponseCookie

        public void addResponseCookie​(String name,
                                      String value,
                                      Map<String,​Object> properties)
        Description copied from class: ExternalContext

        Adds the cookie represented by the arguments to the response.

        Jakarta Servlet: This must be accomplished by calling the jakarta.servlet.http.HttpServletResponse method addCookie(). The Cookie argument must be constructed by passing the name and value parameters. If the properties arugument is non-null and not empty, the Cookie instance must be initialized as described below.

        Cookie handling table
        Key in "values" Map (case sensitive) Expected type of value. Name of setter method on Cookie instance to be set with the value from the Map.
        comment String setComment
        domain String setDomain
        maxAge Integer setMaxAge
        secure Boolean setSecure
        path String setPath
        httpOnly Boolean setHttpOnly
        any other attribute (e.g. SameSite) String setAttribute

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        addResponseCookie in class ExternalContext
        Parameters:
        name - To be passed as the first argument to the Cookie constructor.
        value - To be passed as the second argument to the Cookie constructor.
        properties - A Map containg key/value pairs to be passed as arguments to the setter methods as described above.
        See Also:
        ExternalContext.addResponseCookie(String, String, java.util.Map)
      • getResponseOutputStream

        public OutputStream getResponseOutputStream()
                                             throws IOException
        Description copied from class: ExternalContext

        Returns an OutputStream suitable for writing binary data to the user-agent.

        Jakarta Servlet: This must return the value returned by the jakarta.servlet.ServletResponse method getOutputStream().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getResponseOutputStream in class ExternalContext
        Returns:
        the OutputStream for the current response.
        Throws:
        IOException - any IO related exception.
        See Also:
        ExternalContext.getResponseOutputStream()
      • getResponseOutputWriter

        public Writer getResponseOutputWriter()
                                       throws IOException
        Description copied from class: ExternalContext

        Returns a Writer suitable for writing character data to the user-agent.

        Jakarta Servlet: This must return the value returned by the ServletResponse.getWriter().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getResponseOutputWriter in class ExternalContext
        Returns:
        the Writer for the current response.
        Throws:
        IOException - any IO related exception.
        See Also:
        ExternalContext.getResponseOutputWriter()
      • getRequestScheme

        public String getRequestScheme()
        Description copied from class: ExternalContext

        Returns the name of the scheme used to make this request, for example, http, https, or ftp.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletRequest method getScheme().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestScheme in class ExternalContext
        Returns:
        the name of the scheme.
        See Also:
        ExternalContext.getRequestScheme()
      • getRequestServerName

        public String getRequestServerName()
        Description copied from class: ExternalContext

        Returns the host name of the server to which the request was sent.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletRequest method getServerName().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestServerName in class ExternalContext
        Returns:
        the host name of the server.
        See Also:
        ExternalContext.getRequestServerName()
      • getRequestServerPort

        public int getRequestServerPort()
        Description copied from class: ExternalContext

        Returns the port number to which the request was sent.

        Jakarta Servlet: This must be the value returned by the jakarta.servlet.ServletRequest method getServerPort().

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getRequestServerPort in class ExternalContext
        Returns:
        the port number to which the request was sent.
        See Also:
        ExternalContext.getRequestServerPort()
      • setResponseContentType

        public void setResponseContentType​(String contentType)
        Description copied from class: ExternalContext

        Sets the content type of the response being sent to the client, if the response has not been committed yet.

        Jakarta Servlet: This must call setContentType() on the underlying jakarta.servlet.ServletResponse instance.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseContentType in class ExternalContext
        Parameters:
        contentType - The content type to be set as the contentType of the response.
        See Also:
        ExternalContext.setResponseContentType(String)
      • setResponseHeader

        public void setResponseHeader​(String name,
                                      String value)
        Description copied from class: ExternalContext

        Set the response header with the given name and value.

        Jakarta Servlet:This must be performed by calling the jakarta.servlet.http.HttpServletResponse setHeader method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseHeader in class ExternalContext
        Parameters:
        name - The name of the response header.
        value - The value of the response header.
        See Also:
        ExternalContext.setResponseHeader(String, String)
      • addResponseHeader

        public void addResponseHeader​(String name,
                                      String value)
        Description copied from class: ExternalContext

        Add the given name and value to the response header.

        Jakarta Servlet:This must be performed by calling the jakarta.servlet.http.HttpServletResponse addHeader method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        addResponseHeader in class ExternalContext
        Parameters:
        name - The name of the response header.
        value - The value of the response header.
        See Also:
        ExternalContext.addResponseHeader(String, String)
      • setResponseBufferSize

        public void setResponseBufferSize​(int size)
        Description copied from class: ExternalContext

        Set the buffer size for the current response.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse setBufferSize method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseBufferSize in class ExternalContext
        Parameters:
        size - the new buffer size
        See Also:
        ExternalContext.setResponseBufferSize(int)
      • isResponseCommitted

        public boolean isResponseCommitted()
        Description copied from class: ExternalContext

        Check if the current response has been committed.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse isCommitted method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        isResponseCommitted in class ExternalContext
        Returns:
        the flag indicating whether the current response has been committed.
        See Also:
        ExternalContext.isResponseCommitted()
      • responseReset

        public void responseReset()
        Description copied from class: ExternalContext

        Resets the current response.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse reset method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        responseReset in class ExternalContext
        See Also:
        ExternalContext.responseReset()
      • responseSendError

        public void responseSendError​(int statusCode,
                                      String message)
                               throws IOException
        Description copied from class: ExternalContext

        Sends an HTTP status code with message.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse sendError method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        responseSendError in class ExternalContext
        Parameters:
        statusCode - an HTTP status code
        message - an option message to detail the cause of the code
        Throws:
        IOException - any IO related exceptions.
        See Also:
        ExternalContext.responseSendError(int, String)
      • setResponseStatus

        public void setResponseStatus​(int statusCode)
        Description copied from class: ExternalContext

        Sets the HTTP status code for the response.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse setStatus method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseStatus in class ExternalContext
        Parameters:
        statusCode - an HTTP status code
        See Also:
        ExternalContext.setResponseStatus(int)
      • responseFlushBuffer

        public void responseFlushBuffer()
                                 throws IOException
        Description copied from class: ExternalContext

        Flushes the buffered response content to the client.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse flushBuffer method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        responseFlushBuffer in class ExternalContext
        Throws:
        IOException - any IO related exception.
        See Also:
        ExternalContext.responseFlushBuffer()
      • setResponseContentLength

        public void setResponseContentLength​(int length)
        Description copied from class: ExternalContext

        Set the content length of the response.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse setContentLength method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setResponseContentLength in class ExternalContext
        Parameters:
        length - the value to be set.
        See Also:
        ExternalContext.setResponseContentLength(int)
      • setSessionMaxInactiveInterval

        public void setSessionMaxInactiveInterval​(int interval)
        Description copied from class: ExternalContext

        Specifies the time, in seconds, between client requests before the Jakarta Servlet container will invalidate this session.

        An interval value of zero or less indicates that the session should never timeout.

        Jakarta Servlet: This must call setMaxInactiveInterval on the underlying jakarta.servlet.http.HttpServletRequest instance.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        setSessionMaxInactiveInterval in class ExternalContext
        Parameters:
        interval - the value to be set.
        See Also:
        ExternalContext.setSessionMaxInactiveInterval(int)
      • getResponseBufferSize

        public int getResponseBufferSize()
        Description copied from class: ExternalContext

        Return the buffer size for the current response.

        Jakarta Servlet: This must be performed by calling the jakarta.servlet.http.HttpServletResponse getBufferSize method.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getResponseBufferSize in class ExternalContext
        Returns:
        the buffer size of the response.
        See Also:
        ExternalContext.getResponseBufferSize()
      • getSessionMaxInactiveInterval

        public int getSessionMaxInactiveInterval()
        Description copied from class: ExternalContext

        Returns the maximum time interval, in seconds, that the Jakarta Servlet container will keep this session open between client accesses. After this interval, the Jakarta Servlet container will invalidate the session. The maximum time interval can be set with the ExternalContext.setSessionMaxInactiveInterval(int) method.

        A return value of zero or less indicates that the session will never timeout.

        Jakarta Servlet: This must return the result of calling getMaxInactiveInterval on the underlying jakarta.servlet.http.HttpSession instance.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        getSessionMaxInactiveInterval in class ExternalContext
        Returns:
        the session maximum inactive interval.
        See Also:
        \
      • isSecure

        public boolean isSecure()
        Description copied from class: ExternalContext

        Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

        Jakarta Servlet: This must return the result of calling isSecure on the underlying jakarta.servlet.http.HttpServletRequest instance.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        isSecure in class ExternalContext
        Returns:
        boolean
        See Also:
        ExternalContext.isSecure()
      • encodeBookmarkableURL

        public String encodeBookmarkableURL​(String baseUrl,
                                            Map<String,​List<String>> parameters)
        Description copied from class: ExternalContext

        The purpose of this method is to generate a query string from the collection of Parameter objects provided by the parameters argument and append that query string to the baseUrl. This method must be able to encode the parameters to a baseUrl that may or may not have existing query parameters. The parameter values should be encoded appropriately for the environment so that the resulting URL can be used as the target of a link (e.g., in an href attribute) in a Jakarta Faces response. It's possible for an ExternalContext implementation to override this method in any way that would make the URL bookmarkable in that environment.

        See ExternalContext.encodeActionURL(java.lang.String) for the required specification of how to encode the ClientWindow.

        The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend this class.

        Overrides:
        encodeBookmarkableURL in class ExternalContext
        Parameters:
        baseUrl - The base URL onto which the query string generated by this method will be appended. The URL may contain query parameters.
        parameters - The collection of Parameter objects, representing name=value pairs that are used to produce a query string
        Returns:
        the result of encoding.
      • encodeRedirectURL

        public String encodeRedirectURL​(String baseUrl,
                                        Map<String,​List<String>> parameters)
        Description copied from class: ExternalContext
        The purpose of this method is to generate a query string from the collection of Parameter objects provided by the parameters argument and append that query string to the baseUrl. This method must be able to encode the parameters to a baseUrl that may or may not have existing query parameters. The parameter values should be encoded appropriately for the environment so that the resulting URL can be used as the target of a redirect. It's possible for an ExternalContext implementation to override this method to accomodate the definition of redirect for that environment.

        See ExternalContext.encodeActionURL(java.lang.String) for the required specification of how to encode the ClientWindow.

        Overrides:
        encodeRedirectURL in class ExternalContext
        Parameters:
        baseUrl - The base URL onto which the query string generated by this method will be appended. The URL may contain query parameters.
        parameters - The collection of Parameter objects, representing name=value pairs that are used to produce a query string
        Returns:
        the result of encoding.
      • getFlash

        public Flash getFlash()
        Description copied from class: ExternalContext

        Return the threadsafe Flash for this application. The default implementation will throw UnsupportedOperationException. Compliant Jakarta Faces runtimes must provide an implementation of this method.

        Overrides:
        getFlash in class ExternalContext
        Returns:
        the Flash for this application.
      • release

        public void release()
        Description copied from class: ExternalContext

        Release any resources associated with this ExternalContext instance. This method is called during during destruction of the associated FacesContext.

        Specified by:
        release in class ExternalContext
      • getFallbackMimeType

        public String getFallbackMimeType​(String file)