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

public Class ConfigureListener

extends Object
implements ServletRequestListener, HttpSessionListener, ServletContextListener
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletContextListener, java.util.EventListener, jakarta.servlet.http.HttpSessionListener, jakarta.servlet.ServletRequestListener
Static Imports
com.sun.faces.RIConstants.ANNOTATED_CLASSES, .RIConstants.ERROR_PAGE_PRESENT_KEY_NAME, .RIConstants.FACES_SERVLET_MAPPINGS, .RIConstants.FACES_SERVLET_REGISTRATION, com.sun.faces.config.InitFacesContext.getInitContextServletContextMap, .WebConfiguration.BooleanWebContextInitParameter.EnableLazyBeanValidation, .WebConfiguration.BooleanWebContextInitParameter.EnableThreading, .WebConfiguration.BooleanWebContextInitParameter.EnableWebsocketEndpoint, .WebConfiguration.BooleanWebContextInitParameter.ForceLoadFacesConfigFiles, .WebConfiguration.BooleanWebContextInitParameter.VerifyFacesConfigObjects, .WebConfiguration.WebContextInitParameter.JakartaFacesProjectStage, com.sun.faces.context.SessionMap.createMutex, .SessionMap.removeMutex, com.sun.faces.push.WebsocketEndpoint.URI_TEMPLATE, java.lang.Boolean.TRUE, java.text.MessageFormat.format, java.util.logging.Level.FINE, .Level.FINEST, .Level.INFO, .Level.SEVERE, .Level.WARNING

Parse all relevant Faces configuration resources, and configure the Mojarra runtime environment.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
ConfigureListener.WebXmlProcessor

Processes a web application's deployment descriptor looking for a reference to jakarta.faces.webapp.FacesServlet.

Field Summary

Modifier and TypeField and Description
private static final Logger
protected WebappLifecycleListener
protected WebConfiguration
private ScheduledThreadPoolExecutor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
contextDestroyed(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being destroyed
sce
)

Overrides default jakarta.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

public void
contextInitialized(ServletContextEvent
the ServletContextEvent containing the ServletContext that is being initialized
servletContextEvent
)

Overrides default jakarta.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

private InitFacesContext
private void
private boolean
private void
reload(ServletContext servletContext)

This method will be invoked WebConfigResourceMonitor when changes to any of the faces-config.xml files included in WEB-INF are modified.

public void
requestDestroyed(ServletRequestEvent
the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application
event
)

Overrides default jakarta.servlet.ServletRequestListener.requestDestroyed.

Receives notification that a ServletRequest is about to go out of scope of the web application.

public void
requestInitialized(ServletRequestEvent
the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application
event
)

Overrides default jakarta.servlet.ServletRequestListener.requestInitialized.

Receives notification that a ServletRequest is about to come into scope of the web application.

public void
sessionCreated(HttpSessionEvent
the HttpSessionEvent containing the session
event
)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionCreated.

Receives notification that a session has been created.

public void
sessionDestroyed(HttpSessionEvent
the HttpSessionEvent containing the session
event
)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionDestroyed.

Receives notification that a session is about to be invalidated.

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
webAppListenerback to summary
protected WebappLifecycleListener webAppListener
webConfigback to summary
protected WebConfiguration webConfig
webResourcePoolback to summary
private ScheduledThreadPoolExecutor webResourcePool

Constructor Detail

ConfigureListenerback to summary
public ConfigureListener()

Method Detail

contextDestroyedback to summary
public void contextDestroyed(ServletContextEvent sce)

Overrides default jakarta.servlet.ServletContextListener.contextDestroyed.

Doc from jakarta.servlet.ServletContextListener.contextDestroyed.

Receives notification that the ServletContext is about to be shut down.

All servlets and filters will have been destroyed before any ServletContextListeners are notified of context destruction.

Parameters
sce:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being destroyed

Annotations
@Override
contextInitializedback to summary
public void contextInitialized(ServletContextEvent servletContextEvent)

Overrides default jakarta.servlet.ServletContextListener.contextInitialized.

Doc from jakarta.servlet.ServletContextListener.contextInitialized.

Receives notification that the web application initialization process is starting.

All ServletContextListeners are notified of context initialization before any filters or servlets in the web application are initialized.

Parameters
servletContextEvent:ServletContextEvent

the ServletContextEvent containing the ServletContext that is being initialized

Annotations
@Override
getInitFacesContextback to summary
private InitFacesContext getInitFacesContext(ServletContext context)
initConfigMonitoringback to summary
private void initConfigMonitoring(ServletContext context)
isDevModeEnabledback to summary
private boolean isDevModeEnabled()
reloadback to summary
private void reload(ServletContext servletContext)

This method will be invoked WebConfigResourceMonitor when changes to any of the faces-config.xml files included in WEB-INF are modified.

requestDestroyedback to summary
public void requestDestroyed(ServletRequestEvent event)

Overrides default jakarta.servlet.ServletRequestListener.requestDestroyed.

Doc from jakarta.servlet.ServletRequestListener.requestDestroyed.

Receives notification that a ServletRequest is about to go out of scope of the web application.

Parameters
event:ServletRequestEvent

the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application

Annotations
@Override
requestInitializedback to summary
public void requestInitialized(ServletRequestEvent event)

Overrides default jakarta.servlet.ServletRequestListener.requestInitialized.

Doc from jakarta.servlet.ServletRequestListener.requestInitialized.

Receives notification that a ServletRequest is about to come into scope of the web application.

Parameters
event:ServletRequestEvent

the ServletRequestEvent containing the ServletRequest and the ServletContext representing the web application

Annotations
@Override
sessionCreatedback to summary
public void sessionCreated(HttpSessionEvent event)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionCreated.

Doc from jakarta.servlet.http.HttpSessionListener.sessionCreated.

Receives notification that a session has been created.

Parameters
event:HttpSessionEvent

the HttpSessionEvent containing the session

Annotations
@Override
sessionDestroyedback to summary
public void sessionDestroyed(HttpSessionEvent event)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionDestroyed.

Doc from jakarta.servlet.http.HttpSessionListener.sessionDestroyed.

Receives notification that a session is about to be invalidated.

Parameters
event:HttpSessionEvent

the HttpSessionEvent containing the session

Annotations
@Override
shouldInitConfigMonitoringback to summary
private boolean shouldInitConfigMonitoring()
com.sun.faces.config back to summary

private Class ConfigureListener.WebConfigResourceMonitor

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • com.sun.faces.config.ConfigureListener.WebConfigResourceMonitor
All Implemented Interfaces
java.lang.Runnable

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private List<ConfigureListener.WebConfigResourceMonitor.Monitor>
private final ServletContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

PENDING javadocs

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

monitorsback to summary
private List<ConfigureListener.WebConfigResourceMonitor.Monitor> monitors
servletContextback to summary
private final ServletContext servletContext

Constructor Detail

WebConfigResourceMonitorback to summary
public WebConfigResourceMonitor(ServletContext servletContext, Collection<URI> uris)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

PENDING javadocs

Annotations
@Override
com.sun.faces.config back to summary

private Class ConfigureListener.WebConfigResourceMonitor.Monitor

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.faces.config.ConfigureListener.WebConfigResourceMonitor.Monitor

Field Summary

Modifier and TypeField and Description
private long
private final URI

Constructor Summary

AccessConstructor and Description
pack-priv
Monitor(URI uri)

Method Summary

Modifier and TypeMethod and Description
private long
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

timestampback to summary
private long timestamp
uriback to summary
private final URI uri

Constructor Detail

Monitorback to summary
pack-priv Monitor(URI uri) throws IOException

Method Detail

getLastModifiedback to summary
private long getLastModified() throws IOException
hasBeenModifiedback to summary
pack-priv boolean hasBeenModified() throws IOException
com.sun.faces.config back to summary

private Class ConfigureListener.WebXmlProcessor

extends Object
Class Inheritance

Processes a web application's deployment descriptor looking for a reference to jakarta.faces.webapp.FacesServlet.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
ConfigureListener.WebXmlProcessor.WebXmlHandler

A simple SAX handler to process the elements of interested within a web application's deployment descriptor.

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv
WebXmlProcessor(ServletContext
the ServletContext for the application of interest
context
)

When instantiated, the web.xml of the current application will be scanned looking for a references to the FacesServlet.

Method Summary

Modifier and TypeMethod and Description
private SAXParserFactory

Returns:

configured SAXParserFactory
getConfiguredFactory
()

Return a SAXParserFactory instance that is non-validating and is namespace aware.

public boolean
pack-priv boolean

Returns:

true if WEB-INF/web.xml contains a <error-page> element.
isErrorPagePresent
()

pack-priv boolean

Returns:

true if the WebXmlProcessor detected a FacesServlet entry, otherwise return false.

isFacesServletPresent
()

private void
scanForFacesServlet(ServletContext
the ServletContext instance for this application
context
)

Parse the web.xml for the current application and scan for a FacesServlet entry, if found, set the facesServletPresent property to true.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

distributablePresentback to summary
private boolean distributablePresent
errorPagePresentback to summary
private boolean errorPagePresent
facesServletPresentback to summary
private boolean facesServletPresent
WEB_FRAGMENT_PATHback to summary
private static final String WEB_FRAGMENT_PATH
WEB_XML_PATHback to summary
private static final String WEB_XML_PATH

Constructor Detail

WebXmlProcessorback to summary
pack-priv WebXmlProcessor(ServletContext context)

When instantiated, the web.xml of the current application will be scanned looking for a references to the FacesServlet. isFacesServletPresent() will return the appropriate value based on the scan.

Parameters
context:ServletContext

the ServletContext for the application of interest

Method Detail

getConfiguredFactoryback to summary
private SAXParserFactory getConfiguredFactory()

Return a SAXParserFactory instance that is non-validating and is namespace aware.

Returns:SAXParserFactory

configured SAXParserFactory

isDistributablePresentback to summary
public boolean isDistributablePresent()
isErrorPagePresentback to summary
pack-priv boolean isErrorPagePresent()
Returns:boolean

true if WEB-INF/web.xml contains a <error-page> element.

isFacesServletPresentback to summary
pack-priv boolean isFacesServletPresent()
Returns:boolean

true if the WebXmlProcessor detected a FacesServlet entry, otherwise return false.

scanForFacesServletback to summary
private void scanForFacesServlet(ServletContext context)

Parse the web.xml for the current application and scan for a FacesServlet entry, if found, set the facesServletPresent property to true.

Parameters
context:ServletContext

the ServletContext instance for this application

warnProcessingErrorback to summary
private void warnProcessingError(Exception e, ServletContext servletContext)
com.sun.faces.config back to summary

private Class ConfigureListener.WebXmlProcessor.WebXmlHandler

extends DefaultHandler
Class Inheritance

A simple SAX handler to process the elements of interested within a web application's deployment descriptor.

Field Summary

Modifier and TypeField and Description
private StringBuffer
private static final String
private static final String
private static final String
private boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
characters(char[]
The characters.
ch
,
int
The start position in the character array.
start
,
int
The number of characters to use from the character array.
length
)

Overrides org.xml.sax.helpers.DefaultHandler.characters.

Implements org.xml.sax.ContentHandler.characters.

Receive notification of character data inside an element.

public void
endElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
)

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public InputSource
resolveEntity(String
The public identifier, or null if none is available.
publicId
,
String
The system identifier provided in the XML document.
systemId
)

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Resolve an external entity.

public void
startElement(String
The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
uri
,
String
The local name (without prefix), or the empty string if Namespace processing is not being performed.
localName
,
String
The qualified name (with prefix), or the empty string if qualified names are not available.
qName
,
Attributes
The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
attributes
)

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the start of an element.

Inherited from org.xml.sax.helpers.DefaultHandler:
endDocumentendPrefixMappingerrorfatalErrorignorableWhitespacenotationDeclprocessingInstructionsetDocumentLocatorskippedEntitystartDocumentstartPrefixMappingunparsedEntityDeclwarning

Field Detail

contentback to summary
private StringBuffer content
ERROR_PAGEback to summary
private static final String ERROR_PAGE
FACES_SERVLETback to summary
private static final String FACES_SERVLET
SERVLET_CLASSback to summary
private static final String SERVLET_CLASS
servletClassFoundback to summary
private boolean servletClassFound

Constructor Detail

WebXmlHandlerback to summary
private WebXmlHandler()

Method Detail

charactersback to summary
public void characters(char[] ch, int start, int length) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.characters.

Implements org.xml.sax.ContentHandler.characters.

Doc from org.xml.sax.helpers.DefaultHandler.characters.

Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Parameters
ch:char[]

The characters.

start:int

The start position in the character array.

length:int

The number of characters to use from the character array.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
endElementback to summary
public void endElement(String uri, String localName, String qName) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.endElement.

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.helpers.DefaultHandler.endElement.

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
resolveEntityback to summary
public InputSource resolveEntity(String publicId, String systemId) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.resolveEntity.

Implements org.xml.sax.EntityResolver.resolveEntity.

Doc from org.xml.sax.helpers.DefaultHandler.resolveEntity.

Resolve an external entity.

Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.

Parameters
publicId:String

The public identifier, or null if none is available.

systemId:String

The system identifier provided in the XML document.

Returns:InputSource

The new input source, or null to require the default behaviour.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
startElementback to summary
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException

Overrides org.xml.sax.helpers.DefaultHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from org.xml.sax.helpers.DefaultHandler.startElement.

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Parameters
uri:String

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.

localName:String

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName:String

The qualified name (with prefix), or the empty string if qualified names are not available.

attributes:Attributes

The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

Annotations
@Override
Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.