Class Utils


  • public final class Utils
    extends java.lang.Object
    The CssFileBuilder provides all specific css builder functionality.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String resolveUrl​(java.lang.String libPath, java.lang.String filePath, java.lang.String url)
      Resolves a relative link from a css style, such as an url to a background image, in respect to the library path.
      static java.lang.String rewriteUrlsInCss​(java.lang.String[] libPathSegs, java.lang.String[] filePathSegs, java.lang.String css, Session session, long maxDataUriSize)
      Resolves relative links within a css, such as an url to a background image, in respect to the library path.
      static java.lang.String rewriteUrlsInCss​(java.lang.String libPath, java.lang.String filePath, java.lang.String css)
      Resolves relative links within a css, such as an url to a background image, in respect to the library path.
      static java.lang.String rewriteUrlsInCss​(java.lang.String libPath, java.lang.String filePath, java.lang.String css, Session session, long maxDataUriSize)
      Resolves relative links within a css, such as an url to a background image, in respect to the library path.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • rewriteUrlsInCss

        public static java.lang.String rewriteUrlsInCss​(java.lang.String libPath,
                                                        java.lang.String filePath,
                                                        java.lang.String css)
        Resolves relative links within a css, such as an url to a background image, in respect to the library path.
        Parameters:
        libPath - the library path.
        filePath - the path of the original css file
        css - the css to transform
        Returns:
        the transformed css
      • rewriteUrlsInCss

        public static java.lang.String rewriteUrlsInCss​(java.lang.String libPath,
                                                        java.lang.String filePath,
                                                        java.lang.String css,
                                                        Session session,
                                                        long maxDataUriSize)
        Resolves relative links within a css, such as an url to a background image, in respect to the library path.
        Parameters:
        libPath - the library path.
        filePath - the path of the original css file
        css - the css to transform
        session - use to auto-inline data uris.
        maxDataUriSize - only inline data uris if smaller
        Returns:
        the transformed css
      • rewriteUrlsInCss

        public static java.lang.String rewriteUrlsInCss​(java.lang.String[] libPathSegs,
                                                        java.lang.String[] filePathSegs,
                                                        java.lang.String css,
                                                        Session session,
                                                        long maxDataUriSize)
        Resolves relative links within a css, such as an url to a background image, in respect to the library path.
        Parameters:
        libPathSegs - the library path segments.
        filePathSegs - the path segments of the original css file
        css - the css to transform
        session - the session to use for embedding the data
        maxDataUriSize - the max size for data uris
        Returns:
        the transformed css
      • resolveUrl

        public static java.lang.String resolveUrl​(java.lang.String libPath,
                                                  java.lang.String filePath,
                                                  java.lang.String url)
        Resolves a relative link from a css style, such as an url to a background image, in respect to the library path. If the given url is absolute, it is returned unchanged. Note that the libPath and filePath need to be canonical in order to work correctly.
        Parameters:
        libPath - the library path.
        filePath - the path of the original css file
        url - the url referenced in the css file
        Returns:
        the resolved url