Class MCRURIResolver

java.lang.Object
org.mycore.common.xml.MCRURIResolver
All Implemented Interfaces:
URIResolver

public final class MCRURIResolver extends Object implements URIResolver
Reads XML documents from various URI types. This resolver is used to read DTDs, XML Schema files, XSL document() usages, xsl:include usages and MyCoRe Editor include declarations. DTDs and Schema files are read from the CLASSPATH of the application when XML is parsed. XML document() calls and xsl:include calls within XSL stylesheets can be read from URIs of type resource, webapp, file, session, query or mcrobject. MyCoRe editor include declarations can read XML files from resource, webapp, file, session, http or https, query, or mcrobject URIs.
Author:
Frank Lützenkirchen, Thomas Scheffler (yagee)
  • Method Details

    • instance

      public static MCRURIResolver instance()
      Returns the MCRURIResolver singleton
    • init

      public static void init(jakarta.servlet.ServletContext ctx)
      Initializes the MCRURIResolver for servlet applications.
      Parameters:
      ctx - the servlet context of this web application
    • getParameterMap

      public static Hashtable<String,String> getParameterMap(String key)
    • getServletContext

      public static jakarta.servlet.ServletContext getServletContext()
    • resolve

      public Source resolve(String href, String base) throws TransformerException
      URI Resolver that resolves XSL document() or xsl:include calls.
      Specified by:
      resolve in interface URIResolver
      Throws:
      TransformerException
      See Also:
    • resolve

      public Element resolve(String uri)
      Reads XML from URIs of various type.
      Parameters:
      uri - the URI where to read the XML from
      Returns:
      the root element of the XML document
    • getScheme

      public String getScheme(String uri, String base)
      Returns the protocol or scheme for the given URI.
      Parameters:
      uri - the URI to parse
      base - if uri is relative, resolve scheme from base parameter
      Returns:
      the protocol/scheme part before the ":"
    • parseStream

      protected Element parseStream(InputStream in) throws JDOMException, IOException
      Reads xml from an InputStream and returns the parsed root element.
      Parameters:
      in - the InputStream that contains the XML document
      Returns:
      the root element of the parsed input stream
      Throws:
      JDOMException
      IOException