Package com.aquima.web.util
Class UrlHelper
java.lang.Object
com.aquima.web.util.UrlHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
absoluteRedirect
(String viewName) Returns a "redirect:"-prefixed view name with a leading slash to indicate we want to redirect to a view relative to the context path.
-
Constructor Details
-
Method Details
-
absoluteRedirect
Returns a "redirect:"-prefixed view name with a leading slash to indicate we want to redirect to a view relative to the context path.This method helps perform the redirection relative to the context path in a uniform manner when some view names already include a leading slash and others don't. It ensures that the redirection is always relative to the context path and not to the current servlet path. (eg. if the current servlet path is
/start/shortcutName
, then redirecting tonoaccess.html
using this method will always returnredirect:/noaccess.html
and neverredirect:noaccess.html
which is equivalent toredirect:/start/noaccess.html
, regardless if the view name isnoaccess.html
or/noaccess.html
.- Parameters:
viewName
- the view name to redirect to (not null)- Returns:
- the redirect view name
-