Class ViewRestSources

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

public class ViewRestSources extends Object
Application views rest mappings configuration object.
Since:
02.12.2019
  • Constructor Details

    • ViewRestSources

      public ViewRestSources()
  • Method Details

    • map

      public void map(String prefix)
      Register root rest mapping prefix.

      Registration may be performed only once: overrides are not allowed. Most likely, gsp application will have configured root mapping, so use carefully in extensions.

      Parameters:
      prefix - view rest mapping prefix
    • map

      public void map(String url, String prefix)
      Register prefix for exact url path (path-mapped prefixes override root mapping).

      Internally, path used without first slash to simplify matching.

      Only one prefix may be registered per url. In case of overriding registration error will be thrown.

      Pay attention that additional asset locations registration may be required, because only templates relative to view class will be correctly resolved, but direct templates may fail to resolve.

      Parameters:
      url - sub url
      prefix - asset classpath location
    • getPrimaryPrefix

      public String getPrimaryPrefix()
      Returns:
      primary view rest mapping prefix or null if not configured
    • getPrefixes

      public Map<String,String> getPrefixes()
      Returns:
      configured prefixes mappings by url
    • merge

      public void merge(ViewRestSources prefixes)
      Merge configurations (in-app config with global extensions).

      Will throw error on configuration override attempt (configuration clash).

      Parameters:
      prefixes - other prefixes configuration