Class UrlHandler
- java.lang.Object
-
- org.bedework.webdav.servlet.shared.UrlHandler
-
- All Implemented Interfaces:
UrlPrefixer,UrlUnprefixer
public class UrlHandler extends Object implements UrlPrefixer, UrlUnprefixer
Prefix or unprefix urls - or not depending on internal state- Author:
- douglm
-
-
Constructor Summary
Constructors Constructor Description UrlHandler(String urlPrefix, String context, boolean relative)UrlHandler(javax.servlet.http.HttpServletRequest req, boolean relative)If relative we assume urls are relative to the host + port.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetUrlPrefix()Stringprefix(String val)Return an appropriately prefixed url.Stringunprefix(String val)Remove any vestige of the host, port or context
-
-
-
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 requestrelative- true for relative urls
-
-
Method Detail
-
prefix
public String prefix(String val)
Description copied from interface:UrlPrefixerReturn 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:
prefixin interfaceUrlPrefixer- Parameters:
val- to prefix- Returns:
- String
-
unprefix
public String unprefix(String val)
Description copied from interface:UrlUnprefixerRemove any vestige of the host, port or context- Specified by:
unprefixin interfaceUrlUnprefixer- Parameters:
val- to unprefix- Returns:
- String
-
getUrlPrefix
public String getUrlPrefix()
- Returns:
- String url prefix (host + port, no context)
-
-