Class DefaultURIResolver

java.lang.Object
org.apache.ws.commons.schema.resolver.DefaultURIResolver
All Implemented Interfaces:
CollectionURIResolver, URIResolver

public class DefaultURIResolver extends Object implements CollectionURIResolver
This resolver provides the means of resolving the imports and includes of a given schema document. The system will call this default resolver if there is no other resolver present in the system.
  • Field Details

    • collectionBaseURI

      private String collectionBaseURI
  • Constructor Details

    • DefaultURIResolver

      public DefaultURIResolver()
  • Method Details

    • resolveEntity

      public InputSource resolveEntity(String namespace, String schemaLocation, String baseUri)
      Try to resolve a schema location to some data.
      Specified by:
      resolveEntity in interface URIResolver
      Parameters:
      namespace - target namespace.
      schemaLocation - system ID.
      baseUri - base URI for the schema.
    • isAbsolute

      protected boolean isAbsolute(String uri)
      Find whether a given uri is relative or not
      Parameters:
      uri -
      Returns:
      boolean
    • getURL

      protected URL getURL(URL contextURL, String spec) throws IOException
      This is essentially a call to "new URL(contextURL, spec)" with extra handling in case spec is a file.
      Parameters:
      contextURL -
      spec -
      Throws:
      IOException
    • getFileURL

      protected URL getFileURL(URL contextURL, String path) throws IOException
      Method getFileURL
      Parameters:
      contextURL -
      path -
      Throws:
      IOException
    • getCollectionBaseURI

      public String getCollectionBaseURI()
      Get the base URI derived from a schema collection. It serves as a fallback from the specified base.
      Specified by:
      getCollectionBaseURI in interface CollectionURIResolver
      Returns:
      URI
    • setCollectionBaseURI

      public void setCollectionBaseURI(String collectionBaseURI)
      set the collection base URI, which serves as a fallback from the base of the immediate schema.
      Specified by:
      setCollectionBaseURI in interface CollectionURIResolver
      Parameters:
      collectionBaseURI - the URI.