Class PrefixingSupportingWebAppLinkBuilder

java.lang.Object
com.foreach.across.modules.web.context.PrefixingSupportingWebAppLinkBuilder
All Implemented Interfaces:
WebAppLinkBuilder

public class PrefixingSupportingWebAppLinkBuilder extends Object implements WebAppLinkBuilder
Default implementation of WebAppLinkBuilder that will resolve any prefixed url and url encode it afterwards. Supports prefix-based urls (eg. @static:/myresource) and avoids urls starting with mailto: or # to be encoded.

Note this implementation requires a HttpServletRequest and HttpServletResponse to be available, so it can only be used within a request-bound thread.

Since:
2.0.0
Author:
Arne Vandamme
  • Constructor Details

    • PrefixingSupportingWebAppLinkBuilder

      public PrefixingSupportingWebAppLinkBuilder(WebAppPathResolver pathResolver, jakarta.servlet.ServletContext servletContext)
  • Method Details

    • buildLink

      public String buildLink(String baseLink)
      Description copied from interface: WebAppLinkBuilder
      Convert the base link to an actual client-side link by processing prefixes, adding the context path and encoding the resulting url.
      Specified by:
      buildLink in interface WebAppLinkBuilder
      Parameters:
      baseLink - to process
      Returns:
      processed link
    • buildLink

      public String buildLink(String baseLink, boolean encodeUrl)
      Description copied from interface: WebAppLinkBuilder
      Convert the base link to an actual client-side link by processing prefixes, adding the context path and (optionally) encoding the resulting url.
      Specified by:
      buildLink in interface WebAppLinkBuilder
      Parameters:
      baseLink - to process
      encodeUrl - true if the url should be encoded afterwards (appends session id)
      Returns:
      processed link