public class Router extends BaseRouter<Controller>
Generates urls and route requests to proper handlers.
Since:
3.3
  • Constructor Details

  • Method Details

    • resourceUrlAsStaticMethod

      public static String resourceUrlAsStaticMethod(String completeKey, String resourceName, Map<String,String> params)
    • encodeContexts

      public static String encodeContexts(Collection<String> includedContexts, Iterable<String> excludedContexts)
      Encodes lists of included and excluded contexts into single key like `batch1,batch2,-excludedBatch3, -excludedBatch4`.
    • decodeContexts

      public static RawRequest decodeContexts(String encodedContexts)
      Decodes context key like `batch1,batch2,-excludedBatch3,-excludedBatch4` into lists of included and excluded contexts.
    • sourceMapUrlToUrl

      public static String sourceMapUrlToUrl(String sourceMapUrl)
      Converting source map url to url, removes `.map` from url.
    • escapeSlashes

      public static String escapeSlashes(String string)
    • unescapeSlashes

      public static String unescapeSlashes(String string)
    • contextBatchUrl

      public String contextBatchUrl(String key, String type, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
      Url helpers.
    • contextBatchSourceMapUrl

      public String contextBatchSourceMapUrl(String key, String type, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • resourceUrlRelativeToContextBatch

      public String resourceUrlRelativeToContextBatch(String key, String type, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • resourceUrl

      public String resourceUrl(String completeKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • resourceSourceMapUrl

      public String resourceSourceMapUrl(String completeKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • pluginResourceUrl

      public String pluginResourceUrl(String pluginKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • resourceUrlWithoutHash

      public String resourceUrlWithoutHash(Resource resource, Map<String,String> params)
    • sourceUrl

      public String sourceUrl(String completeKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • prebuildSourceUrl

      public String prebuildSourceUrl(String completeKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • sourceUrl

      public String sourceUrl(Resource resource)
    • prebuildSourceUrl

      public String prebuildSourceUrl(Resource resource)
    • webResourceBatchUrl

      public String webResourceBatchUrl(String completeKey, String type, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
      It is important for the url structure to be: 1. the same number of sectioned paths as the SinglePluginResource 2. include the module complete key in the path before the resource name This is due to css resources referencing other resources such as images in relative path forms.
    • resourceUrlRelativeToWebResourceBatch

      public String resourceUrlRelativeToWebResourceBatch(String completeKey, String resourceName, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String resourceHash, String bundleHash)
    • sourceMapUrl

      public String sourceMapUrl(String resourceUrl, Map<String,String> generatedParams)
    • cloneWithNewUrlMode

      public Router cloneWithNewUrlMode(boolean useAbsoluteUrl)
      Needed to support legacy API.
    • buildUrlWithPrefix

      public String buildUrlWithPrefix(String url, Map<String,String> params, boolean isResourceSupportCache, boolean isResourceSupportCdn, String hash, String bundleHash)
      Adds prefix to relative url.
    • createController

      protected Controller createController(Globals globals, Request request, Response response)
      Description copied from class: BaseRouter
      Override this method and provide instance of the controller.
      Specified by:
      createController in class BaseRouter<Controller>