Class UrlHandler

    • Constructor Detail

      • UrlHandler

        public UrlHandler​(javax.servlet.http.HttpServletRequest req,
                          boolean relative)
        If relative we assume urls are relative to the host + port. Internally we need to strip off the host + port + context.
        Parameters:
        req - the incoming request
        relative - true for relative urls
      • UrlHandler

        public UrlHandler​(String urlPrefix,
                          String context,
                          boolean relative)
        Parameters:
        urlPrefix - Usually host + port + "/" e.g. example.com:8080/
        context - null, zero length or the servlet context, e.g. caldav
        relative - true if we want relative (to the server) urls
    • Method Detail

      • prefix

        public String prefix​(String val)
                      throws WebdavException
        Description copied from interface: UrlPrefixer
        Return an appropriately prefixed url. The parameter url will be absolute or relative. If relative it may be prefixed with the context path which we need to remove.

        We're doing this because some clients don't handle absolute urls (a violation of the spec)

        Specified by:
        prefix in interface UrlPrefixer
        Returns:
        String
        Throws:
        WebdavException
      • getUrlPrefix

        public String getUrlPrefix()
        Returns:
        String url prefix (host + port, no context)