Top Description Inners Fields Constructors Methods
com.sun.faces.context

public Class ExternalContextImpl

extends ExternalContext
Class Inheritance
Imports
com.sun.faces.RIConstants, com.sun.faces.application.ApplicationAssociate, com.sun.faces.context.flash.ELFlash, com.sun.faces.util.FacesLogger, .MessageUtils, .TypedCollections, .Util, java.util.HashSet, .Collections, .Enumeration, .HashMap, .Iterator, .List, .Locale, .Map, .Set, java.io.IOException, .InputStream, .OutputStream, .UnsupportedEncodingException, .Writer, java.net.MalformedURLException, .URL, java.util.logging.Level, .Logger, javax.faces.FacesException, .FactoryFinder, javax.faces.application.ProjectStage, javax.faces.context.ExternalContext, .FacesContext, .Flash, .FlashFactory, .PartialResponseWriter, .ResponseWriter, javax.faces.lifecycle.ClientWindow, javax.faces.render.ResponseStateManager, javax.servlet.RequestDispatcher, .ServletContext, .ServletException, .ServletRequest, .ServletResponse, javax.servlet.http.Cookie, .HttpServletRequest, .HttpServletResponse, .HttpSession, javax.swing.text.Utilities

This implementation of ExternalContext is specific to the servlet implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Map<String, Object>
private ClientWindow
private Map<String, Object>
private boolean
private Map<String, String>
private Flash
private Map<String, String>
private static final Logger
private static final String
private ServletRequest
private Map<String, String>
private Map<String, String[]>
private Map<String, Object>
private Map<String, String>
private Map<String, String[]>
private ServletResponse
private ServletContext
private Map<String, Object>
pack-priv static final Class<T>
Inherited from javax.faces.context.ExternalContext:
BASIC_AUTHCLIENT_CERT_AUTHDIGEST_AUTHFORM_AUTH

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addResponseCookie(String name, String value, Map<String, Object> properties)

Overrides javax.faces.context.ExternalContext.addResponseCookie.

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
)

Overrides javax.faces.context.ExternalContext.addResponseHeader.

Add the given name and value to the response header.

public void
dispatch(String
Context relative path to the specified resource, which must start with a slash ("/") character
requestURI
)

Implements abstract javax.faces.context.ExternalContext.dispatch.

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

private void
doLastPhaseActions(FacesContext context, boolean outgoingResponseIsRedirect)

public String
encodeActionURL(String
The input URL to be encoded
url
)

Implements abstract javax.faces.context.ExternalContext.encodeActionURL.

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
encodeBookmarkableURL(String
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
)

Overrides javax.faces.context.ExternalContext.encodeBookmarkableURL.

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 String
encodeNamespace(String
Name to be encoded
name
)

Implements abstract javax.faces.context.ExternalContext.encodeNamespace.

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
encodePartialActionURL(String
The input URL to be encoded
url
)

Overrides javax.faces.context.ExternalContext.encodePartialActionURL.

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
encodeRedirectURL(String
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
)

Overrides javax.faces.context.ExternalContext.encodeRedirectURL.

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 String
encodeResourceURL(String
The input URL to be encoded
url
)

Implements abstract javax.faces.context.ExternalContext.encodeResourceURL.

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

public String
encodeWebsocketURL(String
The input URL to be encoded.
url
)

Implements abstract javax.faces.context.ExternalContext.encodeWebsocketURL.

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
getApplicationContextPath()

Overrides javax.faces.context.ExternalContext.getApplicationContextPath.

Return the name of the container context for this application.

public Map<String, Object>
getApplicationMap()

Implements abstract javax.faces.context.ExternalContext.getApplicationMap.

Return a mutable Map representing the application scope attributes for the current application.

public String
getAuthType()

Implements abstract javax.faces.context.ExternalContext.getAuthType.

Return the name of the authentication scheme used to authenticate the current user, if any; otherwise, return null.

public ClientWindow
getClientWindow()

Overrides javax.faces.context.ExternalContext.getClientWindow.

Return the ClientWindow set in a preceding call to setClientWindow, or null if no such call has been made.

public Object
getContext()

Implements abstract javax.faces.context.ExternalContext.getContext.

Return the application environment object instance for the current appication.

public String
getContextName()

Overrides javax.faces.context.ExternalContext.getContextName.

Return the name of the container context for this application.

public String
public Flash
getFlash()

Overrides javax.faces.context.ExternalContext.getFlash.

Return the threadsafe Flash for this application.

public String
getInitParameter(String
Name of the requested initialization parameter
name
)

Implements abstract javax.faces.context.ExternalContext.getInitParameter.

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

public Map<String, String>
getInitParameterMap()

Implements abstract javax.faces.context.ExternalContext.getInitParameterMap.

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.

public String
getMimeType(String
The file for which the mime type should be obtained.
file
)

Overrides javax.faces.context.ExternalContext.getMimeType.

Returns the MIME type of the specified file or null if the MIME type is not known.

private Object
public String
getRealPath(String
The context of the requested initialization parameter
path
)

Overrides javax.faces.context.ExternalContext.getRealPath.

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

public String
getRemoteUser()

Implements abstract javax.faces.context.ExternalContext.getRemoteUser.

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

public Object
getRequest()

Implements abstract javax.faces.context.ExternalContext.getRequest.

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

public String
getRequestCharacterEncoding()

Overrides javax.faces.context.ExternalContext.getRequestCharacterEncoding.

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

public int
getRequestContentLength()

Overrides javax.faces.context.ExternalContext.getRequestContentLength.

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

public String
getRequestContentType()

Overrides javax.faces.context.ExternalContext.getRequestContentType.

Return the MIME Content-Type for this request.

public String
getRequestContextPath()

Implements abstract javax.faces.context.ExternalContext.getRequestContextPath.

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

public Map<String, Object>
getRequestCookieMap()

Implements abstract javax.faces.context.ExternalContext.getRequestCookieMap.

Return an immutable Map whose keys are the set of cookie names included in the current request, and whose values (of type javax.servlet.http.Cookie) are the first (or only) cookie for each cookie name returned by the underlying request.

public Map<String, String>
getRequestHeaderMap()

Implements abstract javax.faces.context.ExternalContext.getRequestHeaderMap.

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.

public Map<String, String[]>
getRequestHeaderValuesMap()

Implements abstract javax.faces.context.ExternalContext.getRequestHeaderValuesMap.

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.

public Locale
getRequestLocale()

Implements abstract javax.faces.context.ExternalContext.getRequestLocale.

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

public Iterator<Locale>
getRequestLocales()

Implements abstract javax.faces.context.ExternalContext.getRequestLocales.

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

public Map<String, Object>
getRequestMap()

Implements abstract javax.faces.context.ExternalContext.getRequestMap.

Return a mutable Map representing the request scope attributes for the current application.

public Map<String, String>
getRequestParameterMap()

Implements abstract javax.faces.context.ExternalContext.getRequestParameterMap.

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.

public Iterator<String>
getRequestParameterNames()

Implements abstract javax.faces.context.ExternalContext.getRequestParameterNames.

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

public Map<String, String[]>
getRequestParameterValuesMap()

Implements abstract javax.faces.context.ExternalContext.getRequestParameterValuesMap.

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.

public String
getRequestPathInfo()

Implements abstract javax.faces.context.ExternalContext.getRequestPathInfo.

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

public String
getRequestScheme()

Overrides javax.faces.context.ExternalContext.getRequestScheme.

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

public String
getRequestServerName()

Overrides javax.faces.context.ExternalContext.getRequestServerName.

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

public int
getRequestServerPort()

Overrides javax.faces.context.ExternalContext.getRequestServerPort.

Returns the port number to which the request was sent.

public String
getRequestServletPath()

Implements abstract javax.faces.context.ExternalContext.getRequestServletPath.

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

public URL
getResource(String
The path to the requested resource, which must start with a slash ("/" character
path
)

Implements abstract javax.faces.context.ExternalContext.getResource.

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

public InputStream
getResourceAsStream(String
The path to the requested resource, which must start with a slash ("/" character
path
)

Implements abstract javax.faces.context.ExternalContext.getResourceAsStream.

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

public Set<String>
getResourcePaths(String
Partial path used to match resources, which must start with a slash ("/") character
path
)

Implements abstract javax.faces.context.ExternalContext.getResourcePaths.

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

public Object
getResponse()

Implements abstract javax.faces.context.ExternalContext.getResponse.

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

public int
getResponseBufferSize()

Overrides javax.faces.context.ExternalContext.getResponseBufferSize.

Return the buffer size for the current response.

public String
getResponseCharacterEncoding()

Overrides javax.faces.context.ExternalContext.getResponseCharacterEncoding.

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

public String
getResponseContentType()

Overrides javax.faces.context.ExternalContext.getResponseContentType.

Return the MIME Content-Type for this response.

public OutputStream
getResponseOutputStream()

Overrides javax.faces.context.ExternalContext.getResponseOutputStream.

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

public Writer
getResponseOutputWriter()

Overrides javax.faces.context.ExternalContext.getResponseOutputWriter.

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

public Object
getSession(boolean
Flag indicating whether or not a new session should be created if there is no session associated with the current request
create
)

Implements abstract javax.faces.context.ExternalContext.getSession.

If the create parameter is true, create (if necessary) and return a session instance associated with the current request.

public String
getSessionId(boolean
Flag indicating whether or not a new session should be created if there is no session associated with the current request
create
)

Overrides javax.faces.context.ExternalContext.getSessionId.

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

public Map<String, Object>
getSessionMap()

Implements abstract javax.faces.context.ExternalContext.getSessionMap.

Return a mutable Map representing the session scope attributes for the current application.

public int
getSessionMaxInactiveInterval()

Overrides javax.faces.context.ExternalContext.getSessionMaxInactiveInterval.

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.

public Principal
getUserPrincipal()

Implements abstract javax.faces.context.ExternalContext.getUserPrincipal.

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

public void
invalidateSession()

Overrides javax.faces.context.ExternalContext.invalidateSession.

Invalidates this session then unbinds any objects bound to it.

public boolean
isResponseCommitted()

Overrides javax.faces.context.ExternalContext.isResponseCommitted.

Check if the current response has been committed.

public boolean

Returns:

boolean
isSecure
()

Overrides javax.faces.context.ExternalContext.isSecure.

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

public boolean
isUserInRole(String
Logical role name to be checked
role
)

Implements abstract javax.faces.context.ExternalContext.isUserInRole.

Return true if the currently authenticated user is included in the specified role.

public void
log(String
Message to be logged
message
)

Implements abstract javax.faces.context.ExternalContext.log.

Log the specified message to the application object.

public void
log(String
Message to be logged
message
,
Throwable
Exception to be logged
throwable
)

Implements abstract javax.faces.context.ExternalContext.log.

Log the specified message and exception to the application object.

private void
public void
redirect(String
Absolute URL to which the client should be redirected
requestURI
)

Implements abstract javax.faces.context.ExternalContext.redirect.

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

public void
responseFlushBuffer()

Overrides javax.faces.context.ExternalContext.responseFlushBuffer.

Flushes the buffered response content to the client.

public void
responseReset()

Overrides javax.faces.context.ExternalContext.responseReset.

Resets the current response.

public void
responseSendError(int
an HTTP status code
statusCode
,
String
an option message to detail the cause of the code
message
)

Overrides javax.faces.context.ExternalContext.responseSendError.

Sends an HTTP status code with message.

public void
setClientWindow(ClientWindow
the window with which this instance is associated.
window
)

Overrides javax.faces.context.ExternalContext.setClientWindow.

Associate this instance with a ClientWindow.

public void
setRequest(Object
the request object to be set.
request
)

Overrides javax.faces.context.ExternalContext.setRequest.

Set the environment-specific request to be returned by subsequent calls to getRequest.

public void
setRequestCharacterEncoding(String
the encoding name to be set.
encoding
)

Overrides javax.faces.context.ExternalContext.setRequestCharacterEncoding.

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
)

Overrides javax.faces.context.ExternalContext.setResponse.

Set the environment-specific response to be returned by subsequent calls to getResponse.

public void
setResponseBufferSize(int
the new buffer size
size
)

Overrides javax.faces.context.ExternalContext.setResponseBufferSize.

Set the buffer size for the current response.

public void
setResponseCharacterEncoding(String
the character encoding to be sent by the current response.
encoding
)

Overrides javax.faces.context.ExternalContext.setResponseCharacterEncoding.

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

public void
setResponseContentLength(int
the value to be set.
length
)

Overrides javax.faces.context.ExternalContext.setResponseContentLength.

Set the content length of the response.

public void
setResponseContentType(String
The content type to be set as the contentType of the response.
contentType
)

Overrides javax.faces.context.ExternalContext.setResponseContentType.

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
)

Overrides javax.faces.context.ExternalContext.setResponseHeader.

Set the response header with the given name and value.

public void
setResponseStatus(int
an HTTP status code
statusCode
)

Overrides javax.faces.context.ExternalContext.setResponseStatus.

Sets the HTTP status code for the response.

public void
setSessionMaxInactiveInterval(int
the value to be set.
interval
)

Overrides javax.faces.context.ExternalContext.setSessionMaxInactiveInterval.

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