Class UrlHandler
java.lang.Object
org.bedework.webdav.servlet.shared.UrlHandler
- All Implemented Interfaces:
UrlPrefixer,UrlUnprefixer
Prefix or unprefix urls - or not depending on internal state
- Author:
- douglm
-
Constructor Summary
ConstructorsConstructorDescriptionUrlHandler(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
-
Constructor Details
-
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
-
UrlHandler
- Parameters:
urlPrefix- Usually host + port + "/" e.g. example.com:8080/context- null, zero length or the servlet context, e.g. caldavrelative- true if we want relative (to the server) urls
-
-
Method Details
-
prefix
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
Description copied from interface:UrlUnprefixerRemove any vestige of the host, port or context- Specified by:
unprefixin interfaceUrlUnprefixer- Parameters:
val- to unprefix- Returns:
- String
-
getUrlPrefix
- Returns:
- String url prefix (host + port, no context)
-