Package dap4.servlet

Interface URLMap

  • All Known Implementing Classes:
    URLMapDefault

    public interface URLMap
    Provide a map from url path -> file system path. The idea is that the space of url paths forms a tree with the paths in the tree being of varying length. Each leaf in the tree is associated with a file path prefix. It is assumed that if the suffix of the url (the part after the prefix from the map) is appended to the path associated with the leaf, then we will have a full file system path leading to the file (or directory) to which we the full url refers.
    • Method Detail

      • mapURL

        URLMap.Result mapURL​(String urlpath)
                      throws dap4.core.util.DapException
        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.
        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

        URLMap.Result mapPath​(String path)
                       throws dap4.core.util.DapException
        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.
        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.

      • addEntry

        void addEntry​(String urlprefix,
                      String fileprefix)
               throws dap4.core.util.DapException
        Add an entry into the map. Any trailing / on urlprefix or leading / on file prefix will be removed.
        Parameters:
        urlprefix -
        fileprefix -
        Throws:
        dap4.core.util.DapException