Class MetaData

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

public class MetaData extends Object
MetaData All data associated with the configuration and deployment of a web application.
  • 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
      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
    • addDiscoveredAnnotations

      public void addDiscoveredAnnotations(List<DiscoveredAnnotation> annotations)
      Annotations such as WebServlet, WebFilter, WebListener that can be discovered by scanning unloaded classes.
      Parameters:
      annotations - the list of discovered annotations to add
    • 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()
    • resolve

      public void resolve(WebAppContext context) throws Exception
      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

      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)
      Parameters:
      validateXml - if true xml syntax is validated by the parser, false otherwise
    • getOrigins

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