This class allows the Faces API to be unaware of the nature of its containing application environment. In particular, this class allows Jakarta Faces based applications to run in either a Jakarta Servlet or a Portlet environment.
The documentation for this class only specifies the behavior for the Jakarta Servlet implementation of
ExternalContext. The Portlet implementation of ExternalContext is specified under
the revision of the Portlet Bridge Specification for JavaServer
Faces JSR that corresponds to this version of the Jakarta Faces Specification.
See the Preface of the Jakarta Faces Specification Document, for a reference.
If a reference to an ExternalContext is obtained during application startup or shutdown time, any method
documented as "valid to call this method during application startup or shutdown" must be supported during application
startup or shutdown time. The result of calling a method during application startup or shutdown time that does not
have this designation is undefined.
An ExternalContext can be injected into a CDI managed bean using
@Inject ExternalContext externalContext;
| Modifier and Type | Field and Description |
|---|---|
| public static final String | BASIC_AUTH
String identifier for BASIC authentication. |
| public static final String | CLIENT_CERT_AUTH
String identifier for CLIENT_CERT authentication. |
| private ExternalContext | |
| public static final String | DIGEST_AUTH
String identifier for DIGEST authentication. |
| public static final String | FORM_AUTH
String identifier for FORM authentication. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addResponseCookie(String
To be passed as the first argument to the name, String Cookie constructor.To be passed as the second argument to the value, Map<String, Object> Cookie constructor.A properties)Map containg key/value pairs to be passed as arguments to the setter methods as
described above.Adds the cookie represented by the arguments to the response. |
| public void | addResponseHeader(String
The name of the response header. name, String The value of the response header. value)Add the given name and value to the response header. |
| public abstract void | |
| public abstract String | Returns: the encoded URL.The input URL to be encoded url)Return the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable action in the current application. |
| public String | Returns: the result of encoding.The base URL onto which the query string generated by this method will be appended. The URL may
contain query parameters. baseUrl, Map<String, List<String>> The collection of Parameter objects, representing name=value pairs that are used to produce a query
string parameters)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. |
| public abstract String | Returns: the unique name prefixed with namespace.Name to be encoded name)Return the specified name, after prefixing it with a namespace that ensures that it will be unique within the context of a particular page. |
| public String | Returns: the encoded URL.The input URL to be encoded url)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. |
| public String | Returns: the result of encoding.The base URL onto which the query string generated by this method will be appended. The URL may
contain query parameters. baseUrl, Map<String, List<String>> The collection of Parameter objects, representing name=value pairs that are used to produce a query
string parameters)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. |
| public abstract String | Returns: the encoded resource URL.The input URL to be encoded url)Return the input URL, after performing any rewriting needed to ensure that it will correctly identify an addressable resource in the current application. |
| public abstract String | Returns: the encoded websocket URL.The input URL to be encoded. url)Return the websocket URL, after performing any rewriting needed to ensure that it will correctly identify an addressable websocket in the current application. |
| public String | Returns: the context path of this application.Return the name of the container context for this application. |
| public abstract Map | Returns: the map associated with the backedServletContext.
Return a mutable |
| public abstract String | Returns: the authentication type.
Return the name of the authentication scheme used to authenticate the current user, if any; otherwise, return
|
| public ClientWindow | Returns: the instance of theClientWindow.
Return the |
| public abstract Object | Returns: the object of theServletContext.Return the application environment object instance for the current appication. |
| public String | Returns: the name theServletContext.Return the name of the container context for this application. |
| public Flash | |
| public abstract String | Returns: the value of the specified parameter.Name of the requested initialization parameter name)Return the value of the specified application initialization parameter (if any). |
| public abstract Map | Returns: the init parameter map for this application.
Return an immutable |
| public String | Returns: the MIME type of the file.The file for which the mime type should be obtained. file)
Returns the MIME type of the specified file or |
| public String | Returns: the real path for the specified virtual path.The context of the requested initialization parameter path)Returns a String containing the real path for a given virtual path. |
| public abstract String | Returns: the user name of the current request.
Return the login name of the user making the current request if any; otherwise, return |
| public abstract Object | Returns: the instance of the current request.Return the environment-specific object instance for the current request. |
| public String | Returns: the character encoding currently being used.Return the character encoding currently being used to interpret this request. |
| public int | Returns: the content length of the current request.
Return the result of calling |
| public String | Returns: the Content-Type for this request.Return the MIME Content-Type for this request. |
| public abstract String | Returns: the context path for this request.Return the portion of the request URI that identifies the web application context for this request. |
| public abstract Map | Returns: the cookie map in the current request.
Return an immutable |
| public abstract Map | Returns: the header map in the current request.
Return an immutable |
| public abstract Map | Returns: the header values map in the current request.
Return an immutable |
| public abstract Locale | Returns: theLocale of the current request.
Return the preferred |
| public abstract Iterator | Returns: theIterator of Locales of the current request.
Return an |
| public abstract Map | Returns: the map including the attributes of the current request.
Return a mutable |
| public abstract Map | Returns: the map for the current request parameters.
Return an immutable |
| public abstract Iterator | Returns: theIterator for the names of the current request parameters.
Return an |
| public abstract Map | Returns: the map for the parameter values of the current request.
Return an immutable |
| public abstract String | Returns: the path information of the current request.
Return the extra path information (if any) included in the request URI; otherwise, return |
| public String | Returns: the name of the scheme.Returns the name of the scheme used to make this request, for example, http, https, or ftp. |
| public String | Returns: the host name of the server.Returns the host name of the server to which the request was sent. |
| public int | Returns: the port number to which the request was sent.Returns the port number to which the request was sent. |
| public abstract String | Returns: the Jakarta Servlet path information of the current request.
Return the Jakarta Servlet path information (if any) included in the request URI; otherwise, return
|
| public abstract URL | Returns: the URL of the resource.The path to the requested resource, which must start with a slash ("/" character path)
Return a |
| public abstract InputStream | Returns: theInputStream for the application resource.The path to the requested resource, which must start with a slash ("/" character path)
Return an |
| public abstract Set | Returns: theSet of resource paths for the application resources.Partial path used to match resources, which must start with a slash ("/") character path)
Return the |
| public abstract Object | Returns: the instance of the currentjakarta.servlet.http.HttpServletResponse.Return the environment-specific object instance for the current response. |
| public int | Returns: the buffer size of the response.Return the buffer size for the current response. |
| public String | Returns: the name of the character encoding.Returns the name of the character encoding (MIME charset) used for the body sent in this response. |
| public String | Returns: the MIME Content-Type for this response.Return the MIME Content-Type for this response. |
| public OutputStream | Returns: theOutputStream for the current response.
Returns an |
| public Writer | Returns: theWriter for the current response.
Returns a |
| public abstract Object | Returns: the session object of the current request.Flag indicating whether or not a new session should be created if there is no session associated with
the current request create)
If the |
| public String | Returns: the session id for the current request.Flag indicating whether or not a new session should be created if there is no session associated with
the current request create)
Return the id of the current session or the empty string if no session has been created and the |
| public abstract Map | Returns: the session map for the current application.
Return a mutable |
| public int | Returns: the session maximum inactive interval.Returns the maximum time interval, in seconds, that the Jakarta Servlet container will keep this session open between client accesses. |
| public abstract Principal | Returns: thePrincipal object.
Return the |
| public void | |
| public boolean | Returns: the flag indicating whether the current response has been committed.Check if the current response has been committed. |
| public boolean | Returns: the boolean indicating whether this request is secured.Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS. |
| public abstract boolean | Returns: the flag indicating whether the current user is in the specified role.Logical role name to be checked role)
Return |
| public abstract void | |
| public abstract void | |
| public abstract void | redirect(String
Absolute URL to which the client should be redirected url)
Redirect a request to the specified URL, and cause the
|
| public abstract void | |
| public void | |
| public void | |
| public void | responseSendError(int
an HTTP status code statusCode, String an option message to detail the cause of the code message)Sends an HTTP status code with message. |
| public void | setClientWindow(ClientWindow
the window with which this instance is associated. window)
Associate this instance with a |
| public void | setRequest(Object
the request object to be set. request)
Set the environment-specific request to be returned by subsequent calls to |
| public void | setRequestCharacterEncoding(String
the encoding name to be set. encoding)Overrides the name of the character encoding used in the body of this request. |
| public void | setResponse(Object
the response instance to be set. response)
Set the environment-specific response to be returned by subsequent calls to |
| public void | |
| public void | setResponseCharacterEncoding(String
the character encoding to be sent by the current response. encoding)Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. |
| public void | |
| public void | setResponseContentType(String
The content type to be set as the contentType of the response. contentType)Sets the content type of the response being sent to the client, if the response has not been committed yet. |
| public void | setResponseHeader(String
The name of the response header. name, String The value of the response header. value)Set the response header with the given name and value. |
| public void | |
| public void | setSessionMaxInactiveInterval(int
the value to be set. interval)Specifies the time, in seconds, between client requests before the Jakarta Servlet container will invalidate this session. |