Package dap4.servlet

Class URLMapDefault

  • All Implemented Interfaces:
    URLMap

    public class URLMapDefault
    extends Object
    implements URLMap
    Define a URL map that assumes that there some prefix of the urlpath that can be replaced by a path prefix and that everything else is the same. The mapping is carried out from a properties file that has lines of the form =
    • Constructor Detail

      • URLMapDefault

        public URLMapDefault()
    • Method Detail

      • addEntry

        public void addEntry​(String urlpath,
                             String fileprefix)
                      throws dap4.core.util.DapException
        Description copied from interface: URLMap
        Add an entry into the map. Any trailing / on urlprefix or leading / on file prefix will be removed.
        Specified by:
        addEntry in interface URLMap
        Throws:
        dap4.core.util.DapException
      • mapURL

        public URLMap.Result mapURL​(String urlpath)
                             throws dap4.core.util.DapException
        Description copied from interface: URLMap
        Use some maximal prefix of the url path to locate the associated file path prefix. Return a Pair specifying: 1. Pair.prefix: path specifying the file path associated with the url prefix 2. Pair.suffix: the suffix of the url path that was not used.
        Specified by:
        mapURL in interface URLMap
        Parameters:
        urlpath - a string specifying the url path to be mapped
        Returns:
        Pair returning items 1 an 2 above.
        Throws:
        dap4.core.util.DapException - if the map fails

        Note that this map does not deal with the whole url, only the path part because as a rule, the host+port is unknown at the time the map is built and also because there might be multiple hosts using the same map.

      • mapPath

        public URLMap.Result mapPath​(String path)
                              throws dap4.core.util.DapException
        Description copied from interface: URLMap
        Inverse of mapURL; returns a url path and suffix: U,S such that mapURL(U)+S = path Return a Pair specifying: 1. Pair.prefix: path specifying the url path associated with the file prefix 2. Pair.suffix: the suffix of the file path that was not used.
        Specified by:
        mapPath in interface URLMap
        Parameters:
        path - a string specifying the file path to be mapped
        Returns:
        Pair returning items 1 an 2 above.
        Throws:
        dap4.core.util.DapException - if the map fails

        This is an optional operation and if not supported, throw UnsupportedOperationException.