Class UrlHelper

java.lang.Object
com.aquima.web.util.UrlHelper

public class UrlHelper extends Object
  • Constructor Details Link icon

    • UrlHelper Link icon

      public UrlHelper()
  • Method Details Link icon

    • absoluteRedirect Link icon

      public static 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.

      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 to noaccess.html using this method will always return redirect:/noaccess.html and never redirect:noaccess.html which is equivalent to redirect:/start/noaccess.html, regardless if the view name is noaccess.html or /noaccess.html.

      Parameters:
      viewName - the view name to redirect to (not null)
      Returns:
      the redirect view name