Package org.apache.axis2.util
Class MetaInfResources
java.lang.Object
org.apache.axis2.util.MetaInfResources
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-INFholds more than those --services.xml, whose parameters name keystores and password-callback classes, plusMANIFEST.MFand 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 aMETA-INFresource 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.
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 Summary
Modifier and TypeMethodDescriptionstatic InputStreamgetResourceAsStream(AxisService service, String name) Opens a packaged document from the service's own archive.static booleanisServable(String name) Whether a requested name may be served at all: a named.xsdor.wsdl, with no traversal, no scheme and no absolute path.
-
Method Details
-
isServable
Whether a requested name may be served at all: a named.xsdor.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
Opens a packaged document from the service's own archive.- Parameters:
service- the service whose archive is being askedname- 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
-