Top Description Inners Fields Constructors Methods
org.eclipse.jetty.ee10.webapp

public Class MetaData

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.net.URI, java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Objects, jakarta.servlet.ServletContext, org.eclipse.jetty.util.URIUtil, org.eclipse.jetty.util.resource.Resource, .Resources, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory

MetaData All data associated with the configuration and deployment of a web application.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static class
MetaData.OriginInfo

Metadata regarding where a deployable element was declared: by annotation or by descriptor.

Field Summary

Modifier and TypeField and Description
protected boolean
protected final Map<Resource, List<DiscoveredAnnotation>>
protected final List<DescriptorProcessor>
private final AutoLock
protected boolean
protected final List<Resource>
protected final List<Resource>
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<Resource>
protected final List<Resource>
protected final List<WebDescriptor>
protected WebDescriptor
private static final Logger
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
addDiscoveredAnnotation(DiscoveredAnnotation
the discovered annotation
annotation
)

Add an annotation that has been discovered on a class, method or field within a resource eg a jar or dir.

public void
addDiscoveredAnnotations(List<DiscoveredAnnotation>
the list of discovered annotations to add
annotations
)

Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.

public void
addFragmentDescriptor(Resource
the jar of the fragment
jarResource
,
FragmentDescriptor
web-fragment.xml
descriptor
)

Add a web-fragment.xml, and the jar it is contained in.

public void
addOverrideDescriptor(OverrideDescriptor
the override-web.xml
descriptor
)

Add a override-web.xml descriptor.

public void
public void
clear()

Empty ready for reuse

public List<Resource>
public WebDescriptor
private Resource

Returns:

the resource from the list that contains the given resource.
getEnclosingResource
(List<Resource>
the list of resources to check against
resources
,
Resource
the resource for which to find the parent resource
resource
)

Check if the resource is contained within one of the list of resources.

public FragmentDescriptor

Returns:

the web-fragment.xml that defines that name or null
getFragmentDescriptor
(String
the name specified in a web-fragment.xml
name
)

public FragmentDescriptor

Returns:

the FrgmentDescriptor for the web-fragment.xml, or null if none exists
getFragmentDescriptor
(Resource
the web-fragment.xml location as a Resource
descriptorResource
)

public FragmentDescriptor

Returns:

the FragmentDescriptor or null if no web-fragment.xml is associated with the jar
getFragmentDescriptorForJar
(Resource
the jar to check for a mapping to web-fragment.xml
jar
)

Get the web-fragment.xml related to a jar

public Resource

Returns:

the jar that contains the web-fragment.xml with the given name or null
getJarForFragmentName
(String
the name specified in a web-fragment.xml
name
)

public Map<String, FragmentDescriptor>

Returns:

a map of name to FragmentDescriptor, for those FragmentDescriptors that define a name element.
getNamedFragmentDescriptors
()

public Ordering
public Origin
public Descriptor
public MetaData.OriginInfo
public Map<String, MetaData.OriginInfo>
public List<WebDescriptor>
public WebDescriptor
public List<Resource>
public List<Resource>
getWebInfResources(boolean withOrdering)

public boolean
public boolean

Returns:

true if the webapp is distributable, false otherwise
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.

public boolean
public boolean
public boolean

Returns:

true if the parser validates, false otherwise
isValidateXml
()

public void
public void
public void
resolve(WebAppContext
the context to resolve servlets / filters / listeners metadata from
context
)

Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.

public void
setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames)

public void
setDefaultsDescriptor(DefaultsDescriptor
the web-default.xml
descriptor
)

Set the web-default.xml.

public void
public void
public void
setOrigin(String name, Annotation annotation, Class<?> annotated)

public void
public void
setValidateXml(boolean
if true xml syntax is validated by the parser, false otherwise
validateXml
)

Set if true xml syntax is validated by the parser, false otherwise.

public void
setWebDescriptor(WebDescriptor
the web.xml descriptor
descriptor
)

Set the web.xml descriptor.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_allowDuplicateFragmentNamesback to summary
protected boolean _allowDuplicateFragmentNames
_annotationsback to summary
protected final Map<Resource, List<DiscoveredAnnotation>> _annotations
_descriptorProcessorsback to summary
protected final List<DescriptorProcessor> _descriptorProcessors
_lockback to summary
private final AutoLock _lock
_metaDataCompleteback to summary
protected boolean _metaDataComplete
_orderedContainerResourcesback to summary
protected final List<Resource> _orderedContainerResources
_orderedWebInfResourcesback to summary
protected final List<Resource> _orderedWebInfResources
_orderingback to summary
protected Ordering _ordering
_originsback to summary
protected Map<String, MetaData.OriginInfo> _origins
_validateXmlback to summary
protected boolean _validateXml
_webDefaultsRootback to summary
protected WebDescriptor _webDefaultsRoot
_webFragmentNameMapback to summary
protected final Map<String, FragmentDescriptor> _webFragmentNameMap
_webFragmentResourceMapback to summary
protected final Map<Resource, FragmentDescriptor> _webFragmentResourceMap
_webFragmentRootsback to summary
protected final List<FragmentDescriptor> _webFragmentRoots
_webInfClassesback to summary
protected final List<Resource> _webInfClasses
_webInfJarsback to summary
protected final List<Resource> _webInfJars
_webOverrideRootsback to summary
protected final List<WebDescriptor> _webOverrideRoots
_webXmlRootback to summary
protected WebDescriptor _webXmlRoot
LOGback to summary
private static final Logger LOG
ORDERED_LIBSback to summary
public static final String ORDERED_LIBS
VALIDATE_XMLback to summary
public static final String VALIDATE_XML

Constructor Detail

MetaDataback to summary
public MetaData()

Method Detail

addContainerResourceback to summary
public void addContainerResource(Resource jar)
addDescriptorProcessorback to summary
public void addDescriptorProcessor(DescriptorProcessor p)
addDiscoveredAnnotationback to summary
public 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. 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:DiscoveredAnnotation

the discovered annotation

addDiscoveredAnnotationsback to summary
public void addDiscoveredAnnotations(List<DiscoveredAnnotation> annotations)

Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.

Parameters
annotations:List<DiscoveredAnnotation>

the list of discovered annotations to add

addFragmentDescriptorback to summary
public void addFragmentDescriptor(Resource jarResource, FragmentDescriptor descriptor) throws Exception

Add a web-fragment.xml, and the jar it is contained in.

Parameters
jarResource:Resource

the jar of the fragment

descriptor:FragmentDescriptor

web-fragment.xml

Exceptions
Exception:
if unable to add fragment
addOverrideDescriptorback to summary
public void addOverrideDescriptor(OverrideDescriptor descriptor) throws Exception

Add a override-web.xml descriptor.

Parameters
descriptor:OverrideDescriptor

the override-web.xml

addWebInfResourceback to summary
public void addWebInfResource(Resource newResource)
clearback to summary
public void clear()

Empty ready for reuse

getContainerResourcesback to summary
public List<Resource> getContainerResources()
getDefaultsDescriptorback to summary
public WebDescriptor getDefaultsDescriptor()
getEnclosingResourceback to summary
private Resource getEnclosingResource(List<Resource> resources, Resource resource)

Check if the resource is contained within one of the list of resources. In other words, check if the given resource is a sub-resource of one of the list of resources.

Parameters
resources:List<Resource>

the list of resources to check against

resource:Resource

the resource for which to find the parent resource

Returns:Resource

the resource from the list that contains the given resource.

getFragmentDescriptorback to summary
public FragmentDescriptor getFragmentDescriptor(String name)
Parameters
name:String

the name specified in a web-fragment.xml

Returns:FragmentDescriptor

the web-fragment.xml that defines that name or null

getFragmentDescriptorback to summary
public FragmentDescriptor getFragmentDescriptor(Resource descriptorResource)
Parameters
descriptorResource:Resource

the web-fragment.xml location as a Resource

Returns:FragmentDescriptor

the FrgmentDescriptor for the web-fragment.xml, or null if none exists

getFragmentDescriptorForJarback to summary
public FragmentDescriptor getFragmentDescriptorForJar(Resource jar)

Get the web-fragment.xml related to a jar

Parameters
jar:Resource

the jar to check for a mapping to web-fragment.xml

Returns:FragmentDescriptor

the FragmentDescriptor or null if no web-fragment.xml is associated with the jar

getJarForFragmentNameback to summary
public Resource getJarForFragmentName(String name)
Parameters
name:String

the name specified in a web-fragment.xml

Returns:Resource

the jar that contains the web-fragment.xml with the given name or null

getNamedFragmentDescriptorsback to summary
public Map<String, FragmentDescriptor> getNamedFragmentDescriptors()
Returns:Map<String, FragmentDescriptor>

a map of name to FragmentDescriptor, for those FragmentDescriptors that define a name element.

getOrderingback to summary
public Ordering getOrdering()
getOriginback to summary
public Origin getOrigin(String name)
getOriginDescriptorback to summary
public Descriptor getOriginDescriptor(String name)
getOriginInfoback to summary
public MetaData.OriginInfo getOriginInfo(String name)
getOriginsback to summary
public Map<String, MetaData.OriginInfo> getOrigins()
getOverrideDescriptorsback to summary
public List<WebDescriptor> getOverrideDescriptors()
getWebDescriptorback to summary
public WebDescriptor getWebDescriptor()
getWebInfClassesResourcesback to summary
public List<Resource> getWebInfClassesResources()
getWebInfResourcesback to summary
public List<Resource> getWebInfResources(boolean withOrdering)
isAllowDuplicateFragmentNamesback to summary
public boolean isAllowDuplicateFragmentNames()
isDistributableback to summary
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:boolean

true if the webapp is distributable, false otherwise

isMetaDataCompleteback to summary
public boolean isMetaDataComplete()
isOrderedback to summary
public boolean isOrdered()
isValidateXmlback to summary
public boolean isValidateXml()
Returns:boolean

true if the parser validates, false otherwise

orderFragmentsback to summary
public void orderFragments()
removeDescriptorProcessorback to summary
public void removeDescriptorProcessor(DescriptorProcessor p)
resolveback to summary
public void resolve(WebAppContext context) throws Exception

Resolve all servlet/filter/listener metadata from all sources: descriptors and annotations.

Parameters
context:WebAppContext

the context to resolve servlets / filters / listeners metadata from

Exceptions
Exception:
if unable to resolve metadata
setAllowDuplicateFragmentNamesback to summary
public void setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames)
setDefaultsDescriptorback to summary
public void setDefaultsDescriptor(DefaultsDescriptor descriptor) throws Exception

Set the web-default.xml.

Parameters
descriptor:DefaultsDescriptor

the web-default.xml

setOrderingback to summary
public void setOrdering(Ordering o)
setOriginback to summary
public void setOrigin(String name, Descriptor d)
setOriginback to summary
public void setOrigin(String name, Annotation annotation, Class<?> annotated)
setOriginAPIback to summary
public void setOriginAPI(String name)
setValidateXmlback to summary
public void setValidateXml(boolean validateXml)

Set if true xml syntax is validated by the parser, false otherwise.

Parameters
validateXml:boolean

if true xml syntax is validated by the parser, false otherwise

setWebDescriptorback to summary
public void setWebDescriptor(WebDescriptor descriptor) throws Exception

Set the web.xml descriptor.

Parameters
descriptor:WebDescriptor

the web.xml descriptor

setWebInfClassesResourcesback to summary
public void setWebInfClassesResources(List<Resource> dirs)
org.eclipse.jetty.ee10.webapp back to summary

public final Enum MetaData.Complete

extends Enum<MetaData.Complete>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final MetaData.Complete
public static final MetaData.Complete
public static final MetaData.Complete

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static MetaData.Complete
public static MetaData.Complete[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Falseback to summary
public static final MetaData.Complete False
NotSetback to summary
public static final MetaData.Complete NotSet
Trueback to summary
public static final MetaData.Complete True

Constructor Detail

Completeback to summary
private Complete()

Method Detail

valueOfback to summary
public static MetaData.Complete valueOf(String name)
valuesback to summary
public static MetaData.Complete[] values()
org.eclipse.jetty.ee10.webapp back to summary

public Class MetaData.OriginInfo

extends Object
Class Inheritance

Metadata regarding where a deployable element was declared: by annotation or by descriptor.

Field Summary

Modifier and TypeField and Description
private final Class<?>
annotated

The class containing the annotation, if declared by one

private final Annotation
annotation

Reference to the annotation, if declared by one

private final Descriptor
descriptor

Reference to the descriptor, if declared in one

private final String
name

Identifier for the deployable element

private final Origin
origin

Origin of the deployable element

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
public Descriptor
public String
public Origin
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

annotatedback to summary
private final Class<?> annotated

The class containing the annotation, if declared by one

annotationback to summary
private final Annotation annotation

Reference to the annotation, if declared by one

descriptorback to summary
private final Descriptor descriptor

Reference to the descriptor, if declared in one

nameback to summary
private final String name

Identifier for the deployable element

originback to summary
private final Origin origin

Origin of the deployable element

Constructor Detail

OriginInfoback to summary
public OriginInfo(String n, Annotation a, Class<?> ac)
OriginInfoback to summary
public OriginInfo(String n, Descriptor d)
OriginInfoback to summary
public OriginInfo(String n)

Method Detail

getDescriptorback to summary
public Descriptor getDescriptor()
getNameback to summary
public String getName()
getOriginTypeback to summary
public Origin getOriginType()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override