Class ServletContextAdapter

java.lang.Object
jakarta.faces.context.ExternalContext
com.sun.faces.config.initfacescontext.ServletContextAdapter

public class ServletContextAdapter
extends ExternalContext
  • Constructor Details

  • Method Details

    • dispatch

      public void dispatch​(String path) throws IOException
      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:
      path - Context relative path to the specified resource, which must start with a slash ("/") character
      Throws:
      IOException - if an input/output error occurs
    • release

      public void release()
    • encodeActionURL

      public String encodeActionURL​(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 action in the current application.

      Encoding the ClientWindow

      Call ClientWindow.isClientWindowRenderModeEnabled(jakarta.faces.context.FacesContext). If the result is false take no further action and return the rewritten URL. If the result is true, call ExternalContext.getClientWindow(). If the result is non-null, call ClientWindow.getId() and append the id to the query string of the URL, making the necessary allowances for a pre-existing query string or no query-string.

      Call ClientWindow.getQueryURLParameters(jakarta.faces.context.FacesContext). If the result is non-null, for each parameter in the map, unconditionally add that parameter to the URL.

      The name of the query string parameter is given by the value of the constant ResponseStateManager.CLIENT_WINDOW_URL_PARAM.

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

      Specified by:
      encodeActionURL in class ExternalContext
      Parameters:
      url - The input URL to be encoded
      Returns:
      the encoded URL.
    • 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.
    • 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.
    • encodeWebsocketURL

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

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

      Jakarta Servlet: This must ensure that the input URL is prefixed with the correct websocket scheme, domain and port and then encoded by ExternalContext.encodeResourceURL(String).

      Specified by:
      encodeWebsocketURL in class ExternalContext
      Parameters:
      url - The input URL to be encoded.
      Returns:
      the encoded websocket URL.
    • 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.

      For any of the Map methods that cause an element to be removed from the underlying data structure, the following action regarding managed-beans must be taken. If the element to be removed is a managed-bean, and it has one or more public no-argument void return methods annotated with jakarta.annotation.PreDestroy, each such method must be called before the element is removed from the underlying data structure. Elements that are not managed-beans, but do happen to have methods with that annotation must not have those methods called on removal. Any exception thrown by the PreDestroy annotated methods must by caught and not rethrown. The exception may be logged.

      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.
    • getFlash

      public Flash getFlash()
      Description copied from class: ExternalContext

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

      Overrides:
      getFlash in class ExternalContext
      Returns:
      the Flash for this application.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • getRequestLocale

      public Locale getRequestLocale()
      Description copied from class: ExternalContext

      Return the preferred Locale in which the client will accept content.

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

      Specified by:
      getRequestLocale in class ExternalContext
      Returns:
      the Locale of the current request.
    • 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.
    • 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.

      For any of the Map methods that cause an element to be removed from the underlying data structure, the following action regarding managed-beans must be taken. If the element to be removed is a managed-bean, and it has one or more public no-argument void return methods annotated with jakarta.annotation.PreDestroy, each such method must be called before the element is removed from the underlying data structure. Elements that are not managed-beans, but do happen to have methods with that annotation must not have those methods called on removal. Any exception thrown by the PreDestroy annotated methods must by caught and not rethrown. The exception may be logged.

      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.
    • 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.
    • getRequestParameterNames

      public Iterator<String> getRequestParameterNames()
      Description copied from class: ExternalContext

      Return an Iterator over the names of all request parameters included in the current request.

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

      Specified by:
      getRequestParameterNames in class ExternalContext
      Returns:
      the Iterator for the names of the current request parameters.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • getResource

      public URL getResource​(String path) throws MalformedURLException
      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.
      Throws:
      MalformedURLException - if the specified path is not in the correct form
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.

      For any of the Map methods that cause an element to be removed from the underlying data structure, the following action regarding managed-beans must be taken. If the element to be removed is a managed-bean, and it has one or more public no-argument void return methods annotated with jakarta.annotation.PreDestroy, each such method must be called before the element is removed from the underlying data structure. Elements that are not managed-beans, but do happen to have methods with that annotation must not have those methods called on removal. Any exception thrown by the PreDestroy annotated methods must by caught and not rethrown. The exception may be logged.

      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.
    • 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.
    • 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.
    • 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
    • log

      public void log​(String message, Throwable exception)
      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
      exception - Exception to be logged
    • redirect

      public void redirect​(String url) throws IOException
      Description copied from class: ExternalContext

      Redirect a request to the specified URL, and cause the responseComplete() method to be called on the FacesContext instance for the current request.

      The implementation must determine if the request is an Ajax request by obtaining a PartialViewContext instance from the FacesContext and calling PartialViewContext.isAjaxRequest().

      Jakarta Servlet: For non Ajax requests, this must be accomplished by calling the jakarta.servlet.http.HttpServletResponse method sendRedirect().

      For Ajax requests, the implementation must:
      Specified by:
      redirect in class ExternalContext
      Parameters:
      url - Absolute URL to which the client should be redirected
      Throws:
      IOException - if an input/output error occurs
    • 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.
    • setRequestCharacterEncoding

      public void setRequestCharacterEncoding​(String requestCharacterEncoding) 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:
      requestCharacterEncoding - the encoding name to be set.
      Throws:
      UnsupportedEncodingException - if this is not a valid encoding
    • 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.
    • setResponseCharacterEncoding

      public void setResponseCharacterEncoding​(String responseCharacterEncoding)
      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:
      responseCharacterEncoding - the character encoding to be sent by the current response.
    • 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.
    • 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.
    • encodePartialActionURL

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

      Return the input URL, after performing any rewriting needed to ensure that it can be used in a partial page submission (ajax request) to correctly identify an addressable action in the current application.

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

      Jakarta Servlet:Returns the same encoded URL as the ExternalContext.encodeActionURL(String url) method.

      Portlet:Returns an encoded URL that, upon HTTP POST, will invoke the RESOURCE_PHASE of the portlet lifecycle.

      Overrides:
      encodePartialActionURL in class ExternalContext
      Parameters:
      url - The input URL to be encoded
      Returns:
      the encoded URL.
    • 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.