Package org.eclipse.jetty.ee9.webapp
Class MetaData
java.lang.Object
org.eclipse.jetty.ee9.webapp.MetaData
All data associated with the configuration and deployment of a web application.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classMetadata regarding where a deployable element was declared: by annotation or by descriptor. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Map<Resource,List<DiscoveredAnnotation>> protected final List<DescriptorProcessor>protected booleanprotected Orderingprotected Map<String,MetaData.OriginInfo> protected booleanprotected WebDescriptorprotected final Map<String,FragmentDescriptor> protected final Map<Resource,FragmentDescriptor> protected final List<FragmentDescriptor>protected final List<WebDescriptor>protected WebDescriptorprotected XmlParserstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddDiscoveredAnnotation(DiscoveredAnnotation annotation) Add an annotation that has been discovered on a class, method or field within a resource eg a jar or dir.voidaddDiscoveredAnnotations(List<DiscoveredAnnotation> annotations) Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.voidaddFragmentDescriptor(Resource jarResource, FragmentDescriptor descriptor) Add a web-fragment.xml, and the jar it is contained in.voidaddOverrideDescriptor(OverrideDescriptor descriptor) Add a override-web.xml descriptor.voidaddWebInfResource(Resource newResource) voidclear()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) The XmlParser in use for this metadata.booleanbooleanA 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.booleanbooleanbooleanvoidvoidvoidresolve(WebAppContext context) Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.voidsetAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames) voidsetDefaultsDescriptor(DefaultsDescriptor descriptor) Set the web-default.xml.voidvoidsetOrigin(String name, Annotation annotation, Class<?> annotated) voidsetOrigin(String name, Descriptor d) voidsetOriginAPI(String name) voidsetValidateXml(boolean validateXml) Set if true xml syntax is validated by the parser, false otherwise.voidsetWebDescriptor(WebDescriptor descriptor) Set the web.xml descriptor.voidvoidsetXmlParser(XmlParser xmlParser) Set the XmlParser to use for handling metadata, this will also add an environment specific catalog to the XmlParser.
-
Field Details
-
VALIDATE_XML
- See Also:
-
ORDERED_LIBS
- See Also:
-
_origins
-
_xmlParser
-
_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
-
setXmlParser
Set the XmlParser to use for handling metadata, this will also add an environment specific catalog to the XmlParser.This is useful when you want to configure a custom XML Parser with a variety of custom attributes and configurations.
- Parameters:
xmlParser- the XML parser to use.
-
getXmlParser
The XmlParser in use for this metadata.- Returns:
- the in use XML Parser
-
getOrigins
-