Class ResourceUtils


  • public class ResourceUtils
    extends java.lang.Object
    Author:
    Juergen Donnerstag
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MIN_POSTFIX_DEFAULT
      The default postfix for minified names (ex: /css/mystyle.min.css)
      static java.lang.String MIN_POSTFIX_DEFAULT_AS_EXTENSION
      The default postfix for minified names (ex: /css/mystyle.min.css)
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ResourceUtils.PathLocale getLocaleFromFilename​(java.lang.String path)
      Extract the locale from the filename taking into account possible minimized resource name.
      static java.lang.String getMinifiedName​(java.lang.String name, java.lang.String minPostfix)
      Return the minified version for a given resource name.
      • Methods inherited from class java.lang.Object

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

      • MIN_POSTFIX_DEFAULT

        public static final java.lang.String MIN_POSTFIX_DEFAULT
        The default postfix for minified names (ex: /css/mystyle.min.css)
        See Also:
        Constant Field Values
      • MIN_POSTFIX_DEFAULT_AS_EXTENSION

        public static final java.lang.String MIN_POSTFIX_DEFAULT_AS_EXTENSION
        The default postfix for minified names (ex: /css/mystyle.min.css)
        See Also:
        Constant Field Values
    • Constructor Detail

      • ResourceUtils

        public ResourceUtils()
    • Method Detail

      • getMinifiedName

        public static java.lang.String getMinifiedName​(java.lang.String name,
                                                       java.lang.String minPostfix)
        Return the minified version for a given resource name. For example '/css/coolTheme.css' becomes '/css/coolTheme.min.css'
        Parameters:
        name - The original resource name
        minPostfix - The postfix to use for minified name
        Returns:
        The minified resource name
      • getLocaleFromFilename

        public static ResourceUtils.PathLocale getLocaleFromFilename​(java.lang.String path)
        Extract the locale from the filename taking into account possible minimized resource name. E.g. file_us_EN.min.js will correctly determine a locale of us_EN by stripping the .min from the filename, the filename returned will be file.min.js, if you want the .min to be removed as well, use getLocaleFromFilename(String) instead.
        Parameters:
        path - The file path
        Returns:
        The updated path, without the locale