Class UriMappings

java.lang.Object
org.dlese.dpc.util.uri.UriMappings
All Implemented Interfaces:
ContentHandler

public class UriMappings extends Object implements ContentHandler
Utility class for mapping "static" URIs (i.e. "catalog_(\S+).htm") to dynamic ones (i.e. "view_resource.do?description=$1") using regexes
Author:
ryandear@ucar.edu
  • Constructor Details

    • UriMappings

      public UriMappings(ServletContext servletContext, String xmlParserClass)
      Constructor for the UrlMappings object
      Parameters:
      servletContext -
      xmlParserClass -
  • Method Details

    • loadMappings

      public void loadMappings(String configFile)
      Load URL mappings from the supplied configuration file
      Parameters:
      configFile -
    • getForwardPage

      public String getForwardPage(HttpServletRequest request)
      Gets the forwardPage attribute of the UrlMappings object
      Parameters:
      request -
      Returns:
      The forwardPage value
    • setDocumentLocator

      public void setDocumentLocator(Locator locator)
      (SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number). Could be used to indicate the spot where an error occured.
      Specified by:
      setDocumentLocator in interface ContentHandler
      Parameters:
      locator - The new saxLocator value
    • startDocument

      public void startDocument() throws SAXException
      (SAX) Invoked at the start of any document parse
      Specified by:
      startDocument in interface ContentHandler
      Throws:
      SAXException
    • endDocument

      public void endDocument() throws SAXException
      (SAX) Invoked at the end of parsing. Rewrite the definitions XML if new Ids have been assigned.
      Specified by:
      endDocument in interface ContentHandler
      Throws:
      SAXException
    • startElement

      public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
      (SAX) Invoked upon opening tag of an XML element
      Specified by:
      startElement in interface ContentHandler
      Parameters:
      namespaceURI -
      localName -
      qName -
      atts -
      Throws:
      SAXException
    • endElement

      public void endElement(String namespaceURI, String localName, String qName) throws SAXException
      (SAX) Invoked upon closing tag of an XML element (not used here)
      Specified by:
      endElement in interface ContentHandler
      Parameters:
      namespaceURI - XML namespace
      localName - local tag name
      qName - fully qualified tag name
      Throws:
      SAXException
    • characters

      public void characters(char[] ch, int start, int length) throws SAXException
      (SAX) Element data (characters between tags, not used here)
      Specified by:
      characters in interface ContentHandler
      Parameters:
      ch -
      start -
      length -
      Throws:
      SAXException
    • ignorableWhitespace

      public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
      (SAX) Reports any whitespace that is ignored because it falls outside of the DTD or schema definition--usefull for re-generating the file with indents intact.
      Specified by:
      ignorableWhitespace in interface ContentHandler
      Parameters:
      ch -
      start -
      length -
      Throws:
      SAXException
    • startPrefixMapping

      public void startPrefixMapping(String prefix, String uri) throws SAXException
      (SAX) Required by SAX, but not used here
      Specified by:
      startPrefixMapping in interface ContentHandler
      Parameters:
      prefix -
      uri -
      Throws:
      SAXException
    • endPrefixMapping

      public void endPrefixMapping(String prefix) throws SAXException
      (SAX) Required by SAX, but not used here
      Specified by:
      endPrefixMapping in interface ContentHandler
      Parameters:
      prefix -
      Throws:
      SAXException
    • processingInstruction

      public void processingInstruction(String target, String data) throws SAXException
      (SAX) Required by SAX, but not used here
      Specified by:
      processingInstruction in interface ContentHandler
      Parameters:
      target -
      data -
      Throws:
      SAXException
    • skippedEntity

      public void skippedEntity(String name) throws SAXException
      (SAX) Required by SAX, but not used here
      Specified by:
      skippedEntity in interface ContentHandler
      Parameters:
      name -
      Throws:
      SAXException
    • setDebug

      public static final void setDebug(boolean db)
      Sets the debug attribute of the DDSServlet object
      Parameters:
      db - The new debug value