Top Description Methods
org.eclipse.jetty.ee10.webapp

public Interface Configuration

Known Direct Implementers
org.eclipse.jetty.ee10.webapp.AbstractConfiguration
Imports
java.util.Collection, .Collections, .ServiceLoader, org.eclipse.jetty.util.TopologicalSort

A pluggable Configuration for WebAppContexts.

A WebAppContext is configured by the application of one or more Configuration instances. Typically each implemented Configuration is responsible for an aspect of the servlet specification (eg WebXmlConfiguration, FragmentConfiguration, etc.) or feature (eg JakartaWebSocketConfiguration, JmxConfiguration etc.)

Configuration instances are discovered by the Configurations class using either the ServiceLoader mechanism or by an explicit call to Configurations#setKnown(String...). By default, all Configurations that do not return false from isEnabledByDefault() are applied to all WebAppContexts within the JVM. However a Server wide default Configurations collection may also be defined with Configurations#setServerDefault(org.eclipse.jetty.server.Server). Furthermore, each individual Context may have its Configurations list explicitly set and/or amended with WebAppContext#setConfigurations(Configuration[]), WebAppContext#addConfiguration(Configuration...) or WebAppContext#getConfigurations().

Since EE10 in Jetty-12, Configuration implementations must be stateless/immutable.

Since Jetty-9.4, Configurations are self ordering using the getDependencies() and getDependents() methods for a TopologicalSort initiated by Configurations#sort() when a WebAppContext is started. This means that feature configurations (eg JndiConfiguration, JaasConfiguration} etc.) can be added or removed without concern for ordering.

Also since Jetty-9.4, Configurations are responsible for providing getServerClasses() and getSystemClasses() to configure the WebAppClassLoader for each context.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if configuration should be aborted
abort
(WebAppContext context)

public void
configure(WebAppContext
The context to configure
context
)

Configure WebApp.

public void
deconfigure(WebAppContext
The context to configure
context
)

DeConfigure WebApp.

public void
destroy(WebAppContext
The context to configure
context
)

Destroy WebApp.

public default Collection<String>

Returns:

The names of Configurations that TopologicalSort must order before this configuration.
getDependencies
()

Get known Configuration Dependencies.

public default Collection<String>

Returns:

The names of Configurations that TopologicalSort must order after this configuration.
getDependents
()

Get known Configuration Dependents.

public default ClassMatcher

Returns:

ClassMatcher of server classes.
getServerClasses
()

Get the system classes associated with this Configuration.

public default ClassMatcher

Returns:

ClassMatcher of system classes.
getSystemClasses
()

Get the system classes associated with this Configuration.

public default boolean

Returns:

True if the feature this configuration represents is available and has all its dependencies.
isAvailable
()

public boolean

Returns:

true if configuration is enabled by default
isEnabledByDefault
()

public void
postConfigure(WebAppContext
The context to configure
context
)

Clear down after configuration.

public void
preConfigure(WebAppContext
The context to configure
context
)

Set up for configuration.

public default Class<? extends Configuration>

Returns:

The class this Configuration replaces/extends or null if it replaces no other configuration
replaces
()

Get a class that this class replaces/extends.

Method Detail

abortback to summary
public boolean abort(WebAppContext context)
Returns:boolean

true if configuration should be aborted

configureback to summary
public void configure(WebAppContext context) throws Exception

Configure WebApp.

Typically this step applies the discovered configuration resources to either the WebAppContext or the associated MetaData.

Parameters
context:WebAppContext

The context to configure

Exceptions
Exception:
if unable to configure
deconfigureback to summary
public void deconfigure(WebAppContext context) throws Exception

DeConfigure WebApp. This method is called to undo all configuration done. This is called to allow the context to work correctly over a stop/start cycle

Parameters
context:WebAppContext

The context to configure

Exceptions
Exception:
if unable to deconfigure
destroyback to summary
public void destroy(WebAppContext context) throws Exception

Destroy WebApp. This method is called to destroy a webappcontext. It is typically called when a context is removed from a server handler hierarchy by the deployer.

Parameters
context:WebAppContext

The context to configure

Exceptions
Exception:
if unable to destroy
getDependenciesback to summary
public default Collection<String> getDependencies()

Get known Configuration Dependencies.

Returns:Collection<String>

The names of Configurations that TopologicalSort must order before this configuration.

getDependentsback to summary
public default Collection<String> getDependents()

Get known Configuration Dependents.

Returns:Collection<String>

The names of Configurations that TopologicalSort must order after this configuration.

getServerClassesback to summary
public default ClassMatcher getServerClasses()

Get the system classes associated with this Configuration.

Returns:ClassMatcher

ClassMatcher of server classes.

getSystemClassesback to summary
public default ClassMatcher getSystemClasses()

Get the system classes associated with this Configuration.

Returns:ClassMatcher

ClassMatcher of system classes.

isAvailableback to summary
public default boolean isAvailable()
Returns:boolean

True if the feature this configuration represents is available and has all its dependencies.

isEnabledByDefaultback to summary
public boolean isEnabledByDefault()
Returns:boolean

true if configuration is enabled by default

postConfigureback to summary
public void postConfigure(WebAppContext context) throws Exception

Clear down after configuration.

Parameters
context:WebAppContext

The context to configure

Exceptions
Exception:
if unable to post configure
preConfigureback to summary
public void preConfigure(WebAppContext context) throws Exception

Set up for configuration.

Typically this step discovers configuration resources. Calls to preConfigure may alter the Configurations configured on the WebAppContext, so long as configurations prior to this configuration are not altered.

Parameters
context:WebAppContext

The context to configure

Exceptions
Exception:
if unable to pre configure
replacesback to summary
public default Class<? extends Configuration> replaces()

Get a class that this class replaces/extends. If this is added to Configurations collection that already contains a configuration of the replaced class or that reports to replace the same class, then it is replaced with this instance.

Returns:Class<? extends Configuration>

The class this Configuration replaces/extends or null if it replaces no other configuration