Package org.eclipse.jetty.ee10.webapp
Class MetaData
java.lang.Object
org.eclipse.jetty.ee10.webapp.MetaData
MetaData
All data associated with the configuration and deployment of a web application.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
Metadata regarding where a deployable element was declared: by annotation or by descriptor. -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final Map<Resource,
List<DiscoveredAnnotation>> protected final List<DescriptorProcessor>
protected boolean
protected Ordering
protected Map<String,
MetaData.OriginInfo> protected boolean
protected WebDescriptor
protected final Map<String,
FragmentDescriptor> protected final Map<Resource,
FragmentDescriptor> protected final List<FragmentDescriptor>
protected final List<WebDescriptor>
protected WebDescriptor
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addDiscoveredAnnotation
(DiscoveredAnnotation annotation) Add an annotation that has been discovered on a class, method or field within a resource eg a jar or dir.void
addDiscoveredAnnotations
(List<DiscoveredAnnotation> annotations) Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.void
addFragmentDescriptor
(Resource jarResource, FragmentDescriptor descriptor) Add a web-fragment.xml, and the jar it is contained in.void
addOverrideDescriptor
(OverrideDescriptor descriptor) Add a override-web.xml descriptor.void
addWebInfResource
(Resource newResource) void
clear()
Empty ready for reusegetFragmentDescriptor
(String name) getFragmentDescriptor
(Resource descriptorResource) Get the web-fragment.xml related to a jargetJarForFragmentName
(String name) getOriginDescriptor
(String name) getOriginInfo
(String name) getWebInfResources
(boolean withOrdering) boolean
boolean
A webapp is distributable if web.xml is metadata-complete and distributable=true, or if metadata-complete is false, but all web-fragments.xml are distributable=true.boolean
boolean
boolean
void
void
void
resolve
(WebAppContext context) Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.void
setAllowDuplicateFragmentNames
(boolean allowDuplicateFragmentNames) void
setDefaultsDescriptor
(DefaultsDescriptor descriptor) Set the web-default.xml.void
void
setOrigin
(String name, Annotation annotation, Class<?> annotated) void
setOrigin
(String name, Descriptor d) void
setOriginAPI
(String name) void
setValidateXml
(boolean validateXml) Set if true xml syntax is validated by the parser, false otherwise.void
setWebDescriptor
(WebDescriptor descriptor) Set the web.xml descriptor.void
-
Field Details
-
VALIDATE_XML
- See Also:
-
ORDERED_LIBS
- See Also:
-
_origins
-
_webDefaultsRoot
-
_webXmlRoot
-
_webOverrideRoots
-
_metaDataComplete
protected boolean _metaDataComplete -
_descriptorProcessors
-
_webFragmentRoots
-
_webFragmentNameMap
-
_webFragmentResourceMap
-
_annotations
-
_webInfClasses
-
_webInfJars
-
_orderedContainerResources
-
_orderedWebInfResources
-
_ordering
-
_allowDuplicateFragmentNames
protected boolean _allowDuplicateFragmentNames -
_validateXml
protected boolean _validateXml
-
-
Constructor Details
-
MetaData
public MetaData()
-
-
Method Details
-
clear
public void clear()Empty ready for reuse -
setDefaultsDescriptor
Set the web-default.xml.- Parameters:
descriptor
- the web-default.xml- Throws:
Exception
-
setWebDescriptor
Set the web.xml descriptor.- Parameters:
descriptor
- the web.xml descriptor- Throws:
Exception
-
addOverrideDescriptor
Add a override-web.xml descriptor.- Parameters:
descriptor
- the override-web.xml- Throws:
Exception
-
addFragmentDescriptor
public void addFragmentDescriptor(Resource jarResource, FragmentDescriptor descriptor) throws Exception Add a web-fragment.xml, and the jar it is contained in.- Parameters:
jarResource
- the jar of the fragmentdescriptor
- web-fragment.xml- Throws:
Exception
- if unable to add fragment
-
addDiscoveredAnnotations
Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.- Parameters:
annotations
- the list of discovered annotations to add
-
addDiscoveredAnnotation
Add an annotation that has been discovered on a class, method or field within a resource eg a jar or dir. The annotation may also have no associated resource, or that resource may be a system or container resource. This method is synchronized as it is anticipated that it may be called by many threads during the annotation scanning phase.- Parameters:
annotation
- the discovered annotation
-
addDescriptorProcessor
-
removeDescriptorProcessor
-
orderFragments
public void orderFragments() -
resolve
Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.- Parameters:
context
- the context to resolve servlets / filters / listeners metadata from- Throws:
Exception
- if unable to resolve metadata
-
isDistributable
public boolean isDistributable()A webapp is distributable if web.xml is metadata-complete and distributable=true, or if metadata-complete is false, but all web-fragments.xml are distributable=true.- Returns:
- true if the webapp is distributable, false otherwise
-
getWebDescriptor
-
getOverrideDescriptors
-
getDefaultsDescriptor
-
isOrdered
public boolean isOrdered() -
getOrdering
-
setOrdering
-
getFragmentDescriptor
- Parameters:
name
- the name specified in a web-fragment.xml- Returns:
- the web-fragment.xml that defines that name or null
-
getFragmentDescriptor
- Parameters:
descriptorResource
- the web-fragment.xml location as a Resource- Returns:
- the FrgmentDescriptor for the web-fragment.xml, or null if none exists
-
getJarForFragmentName
- Parameters:
name
- the name specified in a web-fragment.xml- Returns:
- the jar that contains the web-fragment.xml with the given name or null
-
getFragmentDescriptorForJar
Get the web-fragment.xml related to a jar- Parameters:
jar
- the jar to check for a mapping to web-fragment.xml- Returns:
- the FragmentDescriptor or null if no web-fragment.xml is associated with the jar
-
getNamedFragmentDescriptors
- Returns:
- a map of name to FragmentDescriptor, for those FragmentDescriptors that define a name element.
-
getOrigin
-
getOriginInfo
-
getOriginDescriptor
-
setOrigin
-
setOrigin
-
setOriginAPI
-
isMetaDataComplete
public boolean isMetaDataComplete() -
addWebInfResource
-
getWebInfResources
-
getContainerResources
-
addContainerResource
-
setWebInfClassesResources
-
getWebInfClassesResources
-
isAllowDuplicateFragmentNames
public boolean isAllowDuplicateFragmentNames() -
setAllowDuplicateFragmentNames
public void setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames) -
isValidateXml
public boolean isValidateXml()- Returns:
- true if the parser validates, false otherwise
-
setValidateXml
public void setValidateXml(boolean validateXml) Set if true xml syntax is validated by the parser, false otherwise.- Parameters:
validateXml
- if true xml syntax is validated by the parser, false otherwise
-
getOrigins
-