Class Util


  • public class Util
    extends Object
    • Constructor Detail

      • Util

        public Util​(javax.servlet.ServletConfig servletConfig)
    • Method Detail

      • getObjectTimeStampFetcher

        public static nl.gx.webmanager.handler.config.ObjectTimeStampFetcher getObjectTimeStampFetcher()
        Creates an instance of an ObjectTimeStampFetcher. The configured 'timestampfetcher_classname' will be constructed, when this fails the default TSFetcher will be instantiated.
        Returns:
        an instance of an ObjectTimeStampFetcher
      • getSoftTimeStampFetcher

        public static nl.gx.proxy.TimeStampFetcher getSoftTimeStampFetcher​(nl.gx.webmanager.handler.config.ObjectTimeStampFetcher objectTimestampFetcher)
        Creates an instance a softTimeStampFetcher for the given objectTimestampFetcher.
        Parameters:
        objectTimestampFetcher - an objectTimestampFetcher
        Returns:
        softTimeStamp fetcher for the given objectTimestampFetcher
      • setInstance

        public static void setInstance​(Util util)
      • getInstance

        public static Util getInstance()
      • getUserName

        public String getUserName​(javax.servlet.http.HttpServletRequest req)
        Returns whatever is stored under GX_username in the session.
        Parameters:
        req - The request from which the user header should be read.
        Returns:
        the username under stored at GX_username
      • encrypt

        public String encrypt​(String value)
        Return the encrypted, normalized value.
        Parameters:
        value -
        Returns:
        Return the encrypted, normalized value
      • getShowContents

        public String getShowContents​(String urlString,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws IOException
        Return the contents of url.
        Parameters:
        urlString - The url for which the content should be returned
        headers - The extra request headers that should be added to the request to the origin server
        allowCache - Indicates whether cached content is acceptable
        Returns:
        The contents of url
        Throws:
        IOException - If the content could not be read completely
      • getShowConnection

        public nl.gx.proxy.connection.HttpConnection getShowConnection​(String urlString,
                                                                       nl.gx.proxy.Header[] headers,
                                                                       javax.servlet.http.HttpServletRequest request,
                                                                       javax.servlet.http.HttpServletResponse response)
                                                                throws MalformedURLException,
                                                                       IOException
        Creates a connection to the Controller servlet.
        Parameters:
        urlString - The url representation of the contents that should be retrieved
        headers - The headers that should be set when fetching the contents.
        request - The original request that should be used in a request dispatcher.
        response - The original reponse that should be used in a request dispatcher.
        Returns:
        A connection representing the contents of the url.
        Throws:
        MalformedURLException - If the urlString argument could not be parsed.
        IOException - If the content could not be retrieved successfully
      • getContents

        public String getContents​(String urlString,
                                  boolean allowCache)
                           throws IOException
        Return the contents of url.
        Parameters:
        urlString - The url for which the content should be returned
        allowCache - Indicates whether cached content is acceptable
        Returns:
        The contents of url
        Throws:
        IOException - If the content could not be read completely
      • getContents

        public String getContents​(String urlString,
                                  nl.gx.proxy.Header[] headers,
                                  boolean allowCache)
                           throws IOException
        Return the contents of url.
        Parameters:
        urlString - The url for which the content should be returned
        headers - The extra request headers that should be added to the request to the origin server
        allowCache - Indicates whether cached content is acceptable
        Returns:
        The contents of url
        Throws:
        IOException - If the content could not be read completely
      • getExternalContents

        public String getExternalContents​(URL url)
                                   throws IOException
        Return the contents of url.
        Parameters:
        url - The url for which the content should be returned
        Returns:
        The contents of url
        Throws:
        IOException - If the content could not be read completely
      • isSecureServerName

        public static boolean isSecureServerName​(String servername)
        Indicates whether the servername argument is a secure domain.
        Parameters:
        servername - the servername from where the request came
        Returns:
        true if it is a configured secure servername, false otherwise.
      • isUserLoggedInAsEditor

        public static boolean isUserLoggedInAsEditor()
        Returns if the user associated with the active session is logged as an Editor in XC or not.
        Returns:
        true if the user associated with the active session is logged as an Editor in XC, false otherwise
      • loginWithApplicationKey

        public static boolean loginWithApplicationKey​(javax.servlet.http.HttpServletRequest req,
                                                      String applicationKey)
      • getProfilerService

        public static ProfilerService getProfilerService()
        Returns the profiler service which can be used to profile stuff.
        Returns:
        Profiler service