Class MetaData

java.lang.Object
org.eclipse.jetty.ee11.webapp.MetaData

public class MetaData extends Object
The metadata associated with the configuration and deployment of a web application, obtained from descriptors, annotations and direct configuration.
  • Field Details

  • Constructor Details

    • MetaData

      public MetaData()
  • Method Details

    • clear

      public void clear()
      Empty ready for reuse
    • setDefaultsDescriptor

      public void setDefaultsDescriptor(DefaultsDescriptor descriptor) throws Exception
      Set the web-default.xml.
      Parameters:
      descriptor - the web-default.xml
      Throws:
      Exception
    • setWebDescriptor

      public void setWebDescriptor(WebDescriptor descriptor) throws Exception
      Set the web.xml descriptor.
      Parameters:
      descriptor - the web.xml descriptor
      Throws:
      Exception
    • addOverrideDescriptor

      public void addOverrideDescriptor(OverrideDescriptor descriptor) throws Exception
      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 fragment
      descriptor - web-fragment.xml
      Throws:
      Exception - if unable to add fragment
    • addDiscoveredAnnotation

      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 - the discovered annotation
    • addDescriptorProcessor

      public void addDescriptorProcessor(DescriptorProcessor p)
    • removeDescriptorProcessor

      public void removeDescriptorProcessor(DescriptorProcessor p)
    • orderFragments

      public void orderFragments()
    • 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

      public WebDescriptor getWebDescriptor()
    • getOverrideDescriptors

      public List<WebDescriptor> getOverrideDescriptors()
    • getDefaultsDescriptor

      public WebDescriptor getDefaultsDescriptor()
    • isOrdered

      public boolean isOrdered()
    • getOrdering

      public Ordering getOrdering()
    • setOrdering

      public void setOrdering(Ordering o)
    • getFragmentDescriptor

      public FragmentDescriptor getFragmentDescriptor(String name)
      Parameters:
      name - the name specified in a web-fragment.xml
      Returns:
      the web-fragment.xml that defines that name or null
    • getFragmentDescriptor

      public FragmentDescriptor getFragmentDescriptor(Resource descriptorResource)
      Parameters:
      descriptorResource - the web-fragment.xml location as a Resource
      Returns:
      the FrgmentDescriptor for the web-fragment.xml, or null if none exists
    • getJarForFragmentName

      public Resource getJarForFragmentName(String name)
      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

      public FragmentDescriptor getFragmentDescriptorForJar(Resource jar)
      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

      public Map<String,FragmentDescriptor> getNamedFragmentDescriptors()
      Returns:
      a map of name to FragmentDescriptor, for those FragmentDescriptors that define a name element.
    • getOrigin

      public Origin getOrigin(String name)
    • getOriginInfo

      public MetaData.OriginInfo getOriginInfo(String name)
    • getOriginDescriptor

      public Descriptor getOriginDescriptor(String name)
    • setOrigin

      public void setOrigin(String name, Descriptor d)
    • setOrigin

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

      public void setOriginAPI(String name)
    • isMetaDataComplete

      public boolean isMetaDataComplete()
    • addWebInfResource

      public void addWebInfResource(Resource newResource)
    • getWebInfResources

      public List<Resource> getWebInfResources(boolean withOrdering)
    • getContainerResources

      public List<Resource> getContainerResources()
    • addContainerResource

      public void addContainerResource(Resource jar)
    • setWebInfClassesResources

      public void setWebInfClassesResources(List<Resource> dirs)
    • getWebInfClassesResources

      public List<Resource> 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

      public void setXmlParser(XmlParser xmlParser)
      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

      public XmlParser getXmlParser()
      The XmlParser in use for this metadata.
      Returns:
      the in use XML Parser
    • getOrigins

      public Map<String,MetaData.OriginInfo> getOrigins()