Class WebClientConfiguration


  • public final class WebClientConfiguration
    extends java.lang.Object
    The configuration of the web client. Collects configuration parameters from context, default and custom configuration files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CUSTOM_FOLDER
      The folder contiaining the customized configuration files.
      static java.lang.String DEFAULT_FOLDER
      The folder containing the default configuration files
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Parameter getContextParameter​(java.lang.String name)
      Loads a parameter from the servlet context (web.xml and includes).
      static Parameter getContextParameter​(java.lang.String name, javax.servlet.http.HttpSession session)
      Loads a parameter from the servlet context (web.xml and includes).
      static Parameter getContextParameter​(java.lang.String name, javax.servlet.ServletContext context)
      Loads a parameter from the servlet context (web.xml and includes).
      static java.util.Map<java.lang.String,​java.lang.String> getCustomParameters​(java.lang.String filename, boolean caseSensitive)
      Loads all parameters from the specified file in the /custom-config/ folder.
      static Parameter getParameter​(ConfigurationSource source, java.lang.String name)
      Loads a parameter with the specified name from the specified source.
      static Parameter getParameter​(java.lang.String filename, java.lang.String name)
      Loads a parameter from the specified file.
      static java.util.Map<java.lang.String,​java.lang.String> getParameters​(ConfigurationSource source, boolean caseSensitive)
      Loads all parameters from the specified source.
      static java.util.Map<java.lang.String,​java.lang.String> getParameters​(java.lang.String filename, boolean caseSensitive)
      Loads all parameters from the specified file.
      static void init​(javax.servlet.ServletContext context)
      Initializes the configuration by setting the servlet-context of the application.
      static void shutdown()
      Shuts down the WebClientConfiguration instance.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_FOLDER

        public static final java.lang.String DEFAULT_FOLDER
        The folder containing the default configuration files
        See Also:
        Constant Field Values
      • CUSTOM_FOLDER

        public static final java.lang.String CUSTOM_FOLDER
        The folder contiaining the customized configuration files.
        See Also:
        Constant Field Values
    • Method Detail

      • getContextParameter

        public static Parameter getContextParameter​(java.lang.String name)
        Loads a parameter from the servlet context (web.xml and includes). Same as calling getParameter with ConfigurationSource.CONTEXT. Note that this method uses Executions.getCurrent(), so you can call it from within ZK-context only.
        Parameters:
        name - the name of the parameter
        Returns:
        a Parameter containing the value. Never null.
      • getContextParameter

        public static Parameter getContextParameter​(java.lang.String name,
                                                    javax.servlet.http.HttpSession session)
        Loads a parameter from the servlet context (web.xml and includes). Same as calling getParameter with ConfigurationSource.CONTEXT. Use this method when you are outside of the ZK-context (e.g. in a servlet).
        Parameters:
        name - the name of the parameter
        session - the current session
        Returns:
        a Parameter containing the value. Never null.
      • getContextParameter

        public static Parameter getContextParameter​(java.lang.String name,
                                                    javax.servlet.ServletContext context)
        Loads a parameter from the servlet context (web.xml and includes). Same as calling getParameter with ConfigurationSource.CONTEXT. Use this method when you are outside of the ZK-context (e.g. in a servlet).
        Parameters:
        name - the name of the parameter
        context - the current servlet-context
        Returns:
        a Parameter containing the value. Never null.
      • getParameter

        public static Parameter getParameter​(ConfigurationSource source,
                                             java.lang.String name)
        Loads a parameter with the specified name from the specified source.
        Parameters:
        source - the ConfigurationSource to load the parameter from
        name - the name of the parameter
        Returns:
        a parameter containing the value. Never null.
      • getParameters

        public static java.util.Map<java.lang.String,​java.lang.String> getParameters​(ConfigurationSource source,
                                                                                           boolean caseSensitive)
        Loads all parameters from the specified source.
        Parameters:
        source - the ConfigurationSource to load the parameters from
        caseSensitive - if false, the returned map will be an instance of CaseInsensitiveMap
        Returns:
        a map containing the parameters of the source
      • getParameter

        public static Parameter getParameter​(java.lang.String filename,
                                             java.lang.String name)
        Loads a parameter from the specified file. The file is expected to be in standard- properties format and must exist in /config/ folder.
        Parameters:
        filename - the name (with path) of the file to load the parameters from (RELATIVE to the configuration folders)
        name - the name of the parameter
        Returns:
        a parameter containing the value. Never null.
      • getParameters

        public static java.util.Map<java.lang.String,​java.lang.String> getParameters​(java.lang.String filename,
                                                                                           boolean caseSensitive)
        Loads all parameters from the specified file. The file is expected to be in standard- properties format and must exist in /config/ folder.
        Parameters:
        filename - the name (with path) of the file to load the parameters from (RELATIVE to the configuration folders)
        caseSensitive - if false, the returned map will be an instance of CaseInsensitiveMap
        Returns:
        a map containing the parameters of the file
      • getCustomParameters

        public static java.util.Map<java.lang.String,​java.lang.String> getCustomParameters​(java.lang.String filename,
                                                                                                 boolean caseSensitive)
        Loads all parameters from the specified file in the /custom-config/ folder. The file is expected to be in standard-properties format. If the file is not found, an empty map will be returned.
        Parameters:
        filename - the name (with path) of the file to load the parameters from (RELATIVE to the configuration folder)
        caseSensitive - if false, the returned map will be an instance of CaseInsensitiveMap
        Returns:
        a map containing the parameters of the file
      • init

        public static void init​(javax.servlet.ServletContext context)
        Initializes the configuration by setting the servlet-context of the application. This method is supposed to be called once when the application is initialized.
        Parameters:
        context - the ServletContext of the application
      • shutdown

        public static void shutdown()
        Shuts down the WebClientConfiguration instance.