Class MetaInfResources

java.lang.Object
org.apache.axis2.util.MetaInfResources

public class MetaInfResources extends Object
Serves a schema or WSDL document that a service archive packages under META-INF/, by the name the request asked for.

Two properties have to hold on every route that does this, and they used to hold on some and not others, which is why the lookup lives in one place now:

  • Only schema and WSDL documents. A service archive's META-INF holds more than those -- services.xml, whose parameters name keystores and password-callback classes, plus MANIFEST.MF and module policies.
  • Only the queried service's own archive. The lookup uses URLClassLoader.findResource(java.lang.String), which does not delegate to the parent, so a request cannot reach a META-INF resource in an unrelated jar further up the chain -- Axis2's own jars, WEB-INF/lib, or the container's shared libraries. That is the AXIS2-5846 rule.
A classloader that is not a URLClassLoader cannot be searched without delegating, so nothing is served in that case rather than serving too much. Deployed archives always get a DeploymentClassLoader, which is one; an embedder that builds an AxisService against some other classloader loses this route and keeps every other way of publishing a schema.
  • Method Details

    • isServable

      public static boolean isServable(String name)
      Whether a requested name may be served at all: a named .xsd or .wsdl, with no traversal, no scheme and no absolute path.
      Parameters:
      name - the name as the request gave it
      Returns:
      true if it is a document this route is allowed to serve
    • getResourceAsStream

      public static InputStream getResourceAsStream(AxisService service, String name)
      Opens a packaged document from the service's own archive.
      Parameters:
      service - the service whose archive is being asked
      name - the document name as the request gave it
      Returns:
      a stream over the document, or null if it is not servable, not present, or the service's classloader cannot be searched without delegating