-
- All Known Implementing Classes:
AbstractConfiguration,FragmentConfiguration,JaasConfiguration,JettyWebXmlConfiguration,JmxConfiguration,JndiConfiguration,JspConfiguration,MetaInfConfiguration,ServletsConfiguration,WebAppConfiguration,WebInfConfiguration,WebXmlConfiguration
public interface ConfigurationA pluggable Configuration forWebAppContexts.A
WebAppContextis configured by the application of one or moreConfigurationinstances. Typically each implemented Configuration is responsible for an aspect of the servlet specification (egWebXmlConfiguration,FragmentConfiguration, etc.) or feature (egJakartaWebSocketConfiguration,JmxConfigurationetc.)Configuration instances are discovered by the
Configurationsclass using either theServiceLoadermechanism or by an explicit call toConfigurations.setKnown(String...). By default, all Configurations that do not return false fromisEnabledByDefault()are applied to allWebAppContexts within the JVM. However a Server wide defaultConfigurationscollection may also be defined withConfigurations.setServerDefault(org.eclipse.jetty.server.Server). Furthermore, each individual Context may have its Configurations list explicitly set and/or amended withWebAppContext.setConfigurations(Configuration[]),WebAppContext.addConfiguration(Configuration...)orWebAppContext.getConfigurations().Since Jetty-9.4, Configurations are self ordering using the
getDependencies()andgetDependents()methods for aTopologicalSortinitiated byConfigurations.sort()when aWebAppContextis started. This means that feature configurations (egJndiConfiguration,JaasConfiguration} etc.) can be added or removed without concern for ordering.Also since Jetty-9.4, Configurations are responsible for providing
getServerClasses()andgetSystemClasses()to configure theWebAppClassLoaderfor each context.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTR
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanabort(WebAppContext context)voidconfigure(WebAppContext context)Configure WebApp.voiddeconfigure(WebAppContext context)DeConfigure WebApp.voiddestroy(WebAppContext context)Destroy WebApp.default java.util.Collection<java.lang.String>getDependencies()Get known Configuration Dependencies.default java.util.Collection<java.lang.String>getDependents()Get known Configuration Dependents.default ClassMatchergetServerClasses()Get the system classes associated with this Configuration.default ClassMatchergetSystemClasses()Get the system classes associated with this Configuration.default booleanisAvailable()booleanisEnabledByDefault()voidpostConfigure(WebAppContext context)Clear down after configuration.voidpreConfigure(WebAppContext context)Set up for configuration.default java.lang.Class<? extends Configuration>replaces()Get a class that this class replaces/extends.
-
-
-
Field Detail
-
ATTR
static final java.lang.String ATTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
isAvailable
default boolean isAvailable()
- Returns:
- True if the feature this configuration represents is available and has all its dependencies.
-
replaces
default java.lang.Class<? extends Configuration> replaces()
Get a class that this class replaces/extends. If this is added toConfigurationscollection 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:
- The class this Configuration replaces/extends or null if it replaces no other configuration
-
getDependencies
default java.util.Collection<java.lang.String> getDependencies()
Get known Configuration Dependencies.- Returns:
- The names of Configurations that
TopologicalSortmust order before this configuration.
-
getDependents
default java.util.Collection<java.lang.String> getDependents()
Get known Configuration Dependents.- Returns:
- The names of Configurations that
TopologicalSortmust order after this configuration.
-
getSystemClasses
default ClassMatcher getSystemClasses()
Get the system classes associated with this Configuration.- Returns:
- ClassMatcher of system classes.
-
getServerClasses
default ClassMatcher getServerClasses()
Get the system classes associated with this Configuration.- Returns:
- ClassMatcher of server classes.
-
preConfigure
void preConfigure(WebAppContext context) throws java.lang.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- The context to configure- Throws:
java.lang.Exception- if unable to pre configure
-
configure
void configure(WebAppContext context) throws java.lang.Exception
Configure WebApp.Typically this step applies the discovered configuration resources to either the
WebAppContextor the associatedMetaData.- Parameters:
context- The context to configure- Throws:
java.lang.Exception- if unable to configure
-
postConfigure
void postConfigure(WebAppContext context) throws java.lang.Exception
Clear down after configuration.- Parameters:
context- The context to configure- Throws:
java.lang.Exception- if unable to post configure
-
deconfigure
void deconfigure(WebAppContext context) throws java.lang.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- The context to configure- Throws:
java.lang.Exception- if unable to deconfigure
-
destroy
void destroy(WebAppContext context) throws java.lang.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- The context to configure- Throws:
java.lang.Exception- if unable to destroy
-
isEnabledByDefault
boolean isEnabledByDefault()
- Returns:
- true if configuration is enabled by default
-
abort
boolean abort(WebAppContext context)
- Returns:
- true if configuration should be aborted
-
-