Class ViewRestLookup

java.lang.Object
ru.vyarus.guicey.gsp.app.rest.mapping.ViewRestLookup

public class ViewRestLookup extends Object
View rest endpoints are mapped with a prefix: so gsp application call /something could be remapped to [rest]/[prefix]/something. Special prefixes could be mapped to some urls: e.g. /sub/url -> prefix2 and so when /sub/url/something will be called in gsp application it would redirect to [rest]/[prefix2]/something.
Since:
02.12.2019
  • Constructor Details

  • Method Details

    • getPrimaryMapping

      public String getPrimaryMapping()
      Returns:
      main mapping prefix
    • getPrefixes

      public Map<String,String> getPrefixes()
      Returns:
      configured view rest prefixes
    • lookupSubContext

      public String lookupSubContext(String path)
      Lookup target rest context (rest prefix may be registered to sub url). Will select rest prefix context either by sub-url mapping (if url starts with registered sub url) or using root (main) prefix.

      Knowing sub context is important for templates lookup because in case of detected sub context, rest would be "redirected" under this context, but assets must be resolved with a full path (including this context).

      Parameters:
      path - gsp application called url (relative to application mapping root)
      Returns:
      target sub context or empty for root context
    • lookupRestPrefix

      public String lookupRestPrefix(String context)
      Parameters:
      context - context (resolved with lookupSubContext(String))
      Returns:
      target rest prefix for provided context
    • buildRestPath

      public String buildRestPath(String subContext, String path)
      Parameters:
      subContext - context resolved with lookupSubContext(String)
      path - path to resolve
      Returns:
      target rest prefix for provided context