Class ViewRestSources


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

      Constructors 
      Constructor Description
      ViewRestSources()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> getPrefixes()  
      java.lang.String getPrimaryPrefix()  
      void map​(java.lang.String prefix)
      Register root rest mapping prefix.
      void map​(java.lang.String url, java.lang.String prefix)
      Register prefix for exact url path (path-mapped prefixes override root mapping).
      void merge​(ViewRestSources prefixes)
      Merge configurations (in-app config with global extensions).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ViewRestSources

        public ViewRestSources()
    • Method Detail

      • map

        public void map​(java.lang.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​(java.lang.String url,
                        java.lang.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 java.lang.String getPrimaryPrefix()
        Returns:
        primary view rest mapping prefix or null if not configured
      • getPrefixes

        public java.util.Map<java.lang.String,​java.lang.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