Class WebInfConfiguration
- All Implemented Interfaces:
Configuration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassContainerPathNameMatcher Matches names of jars on the container classpath against a pattern.classWebAppPathNameMatcher Matches names of jars or dirs on the webapp classpath against a pattern.Nested classes/interfaces inherited from interface org.eclipse.jetty.webapp.Configuration
Configuration.ClassList, Configuration.Wrapper, Configuration.WrapperFunction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.jetty.util.resource.Resourcestatic final Stringstatic final StringIf set, to a list of URLs, these resources are added to the context resource base as a resource collection.static final Stringstatic final StringFields inherited from interface org.eclipse.jetty.webapp.Configuration
ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneConfigure(WebAppContext template, WebAppContext context) Clone configuration instance.voidconfigure(WebAppContext context) Configure WebApp.voidconfigureTempDirectory(File dir, WebAppContext context) voiddeconfigure(WebAppContext context) DeConfigure WebApp.voidfindAndFilterContainerPaths(WebAppContext context) Find jars and directories that are on the container's classpath and apply an optional filter.voidfindAndFilterWebAppPaths(WebAppContext context) Finds the jars that are either physically or virtually in WEB-INF/lib, and applies an optional filter to their full pathnames.protected List<org.eclipse.jetty.util.resource.Resource>findClassDirs(WebAppContext context) protected List<org.eclipse.jetty.util.resource.Resource>findExtraClasspathDirs(WebAppContext context) Get class dirs from WebAppContext.getExtraClasspath as resourcesprotected List<org.eclipse.jetty.util.resource.Resource>findExtraClasspathJars(WebAppContext context) Get jars from WebAppContext.getExtraClasspath as resourcesprotected List<org.eclipse.jetty.util.resource.Resource>findJars(WebAppContext context) Look for jars that should be treated as if they are in WEB-INF/libprotected org.eclipse.jetty.util.resource.ResourcefindWebInfClassesDir(WebAppContext context) GetWEB-INF/classesdirprotected List<org.eclipse.jetty.util.resource.Resource>findWebInfLibJars(WebAppContext context) Look for jars inWEB-INF/libstatic StringCreate a canonical name for a webapp temp directory.protected static StringgetResourceBaseName(org.eclipse.jetty.util.resource.Resource resource) voidmakeTempDirectory(File parent, WebAppContext context) voidpreConfigure(WebAppContext context) Set up for configuration.voidresolveTempDirectory(WebAppContext context) Get a temporary directory in which to unpack the war etc etc.voidunpack(WebAppContext context) Methods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
destroy, postConfigure
-
Field Details
-
TEMPDIR_CONFIGURED
- See Also:
-
CONTAINER_JAR_PATTERN
- See Also:
-
WEBINF_JAR_PATTERN
- See Also:
-
RESOURCE_DIRS
If set, to a list of URLs, these resources are added to the context resource base as a resource collection.- See Also:
-
_preUnpackBaseResource
protected org.eclipse.jetty.util.resource.Resource _preUnpackBaseResource
-
-
Constructor Details
-
WebInfConfiguration
public WebInfConfiguration()
-
-
Method Details
-
preConfigure
Description copied from interface:ConfigurationSet up for configuration.Typically this step discovers configuration resources
- Specified by:
preConfigurein interfaceConfiguration- Overrides:
preConfigurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to pre configure
-
findAndFilterContainerPaths
Find jars and directories that are on the container's classpath and apply an optional filter. The filter is a pattern applied to the full jar or directory names. If there is no pattern, then no jar or dir is considered to match. Those jars that do match will be later examined for META-INF information and annotations. To find them, examine the classloaders in the hierarchy above the webapp classloader that are URLClassLoaders. For jdk-9 we also look at the java.class.path, and the jdk.module.path.- Parameters:
context- the WebAppContext being deployed- Throws:
Exception- if unable to apply optional filtering on the container's classpath
-
findAndFilterWebAppPaths
Finds the jars that are either physically or virtually in WEB-INF/lib, and applies an optional filter to their full pathnames. The filter selects which jars will later be examined for META-INF information and annotations. If there is no pattern, then all jars are considered selected.- Parameters:
context- the WebAppContext being deployed- Throws:
Exception- if unable to find the jars or apply filtering
-
configure
Description copied from interface:ConfigurationConfigure WebApp.Typically this step applies the discovered configuration resources to either the
WebAppContextor the associatedMetaData.- Specified by:
configurein interfaceConfiguration- Overrides:
configurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to configure
-
deconfigure
Description copied from interface:ConfigurationDeConfigure 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- Specified by:
deconfigurein interfaceConfiguration- Overrides:
deconfigurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to deconfigure
-
cloneConfigure
Description copied from interface:ConfigurationClone configuration instance.Configure an instance of a WebAppContext, based on a template WebAppContext that has previously been configured by this Configuration.
- Specified by:
cloneConfigurein interfaceConfiguration- Overrides:
cloneConfigurein classAbstractConfiguration- Parameters:
template- The template contextcontext- The context to configure- Throws:
Exception- if unable to clone- See Also:
-
resolveTempDirectory
Get a temporary directory in which to unpack the war etc etc. The algorithm for determining this is to check these alternatives in the order shown:A. Try to use an explicit directory specifically for this webapp:
- Iff an explicit directory is set for this webapp, use it. Set delete on exit depends on value of persistTempDirectory.
- Iff javax.servlet.context.tempdir context attribute is set for this webapp && exists && writeable, then use it. Set delete on exit depends on value of persistTempDirectory.
B. Create a directory based on global settings. The new directory will be called
"Jetty-"+host+"-"+port+"__"+context+"-"+virtualhost+"-"+randomdigits+".dir"If the user has specified the context attribute org.eclipse.jetty.webapp.basetempdir, the directory specified by this attribute will be the parent of the temp dir created. Otherwise, the parent dir is
${java.io.tmpdir}. Set delete on exit depends on value of persistTempDirectory.- Parameters:
context- the context to resolve the temp directory from- Throws:
Exception- if unable to resolve the temp directory
-
makeTempDirectory
- Throws:
Exception
-
configureTempDirectory
-
unpack
- Throws:
IOException
-
getCanonicalNameForWebAppTmpDir
Create a canonical name for a webapp temp directory.The form of the name is:
"jetty-"+host+"-"+port+"-"+resourceBase+"-_"+context+"-"+virtualhost+"-"+randomdigits+".dir"
host and port uniquely identify the server context and virtual host uniquely identify the webapp randomdigits ensure every tmp directory is unique- Parameters:
context- the context to get the canonical name from- Returns:
- the canonical name for the webapp temp directory
-
getResourceBaseName
-
findClassDirs
protected List<org.eclipse.jetty.util.resource.Resource> findClassDirs(WebAppContext context) throws Exception - Throws:
Exception
-
findJars
protected List<org.eclipse.jetty.util.resource.Resource> findJars(WebAppContext context) throws Exception Look for jars that should be treated as if they are in WEB-INF/lib- Parameters:
context- the context to find the jars in- Returns:
- the list of jar resources found within context
- Throws:
Exception- if unable to find the jars
-
findWebInfLibJars
protected List<org.eclipse.jetty.util.resource.Resource> findWebInfLibJars(WebAppContext context) throws Exception Look for jars inWEB-INF/lib- Parameters:
context- the context to find the lib jars in- Returns:
- the list of jars as
Resource, or null - Throws:
Exception- if unable to scan for lib jars
-
findExtraClasspathJars
protected List<org.eclipse.jetty.util.resource.Resource> findExtraClasspathJars(WebAppContext context) throws Exception Get jars from WebAppContext.getExtraClasspath as resources- Parameters:
context- the context to find extra classpath jars in- Returns:
- the list of Resources with the extra classpath, or null if not found
- Throws:
Exception- if unable to find the extra classpath jars
-
findWebInfClassesDir
protected org.eclipse.jetty.util.resource.Resource findWebInfClassesDir(WebAppContext context) throws Exception GetWEB-INF/classesdir- Parameters:
context- the context to look for theWEB-INF/classesdirectory- Returns:
- the Resource for the
WEB-INF/classesdirectory - Throws:
Exception- if unable to find theWEB-INF/classesdirectory
-
findExtraClasspathDirs
protected List<org.eclipse.jetty.util.resource.Resource> findExtraClasspathDirs(WebAppContext context) throws Exception Get class dirs from WebAppContext.getExtraClasspath as resources- Parameters:
context- the context to look for extra classpaths in- Returns:
- the list of Resources to the extra classpath
- Throws:
Exception- if unable to find the extra classpaths
-