Class RhinoProperties

java.lang.Object
org.htmlunit.corejs.javascript.config.RhinoProperties

public class RhinoProperties extends Object
Utility class to read current rhino configuration from various properties.

Rhino properties typically begins with "rhino." (properties) or "RHINO_" (env)

You can override this behaviour and implement a RhinoPropertiesLoader and register it as service. If no loader was found, the configuration is read from these locations by default:

  1. rhino.config file from current class' classpath
  2. rhino.config file from current threas's classpath
  3. rhino.config file from current directory
  4. rhino-test.config file from current class' classpath
  5. rhino-test.config file from current threas's classpath
  6. rhino-test.config file from current directory
  7. env variables starting with "RHINO_" (underscores are replaced by '.' and string is
  8. System-properties starting with "rhino."

(the later config can override previous ones)

The config files are in UTF-8 format and all keys in this configuration are case-insensitive and dot/underscore-insensitive.

This means, "rhino.use_java_policy_security=true" is equvalent to "RHINO_USE_JAVA_POLICY_SECURITY=TRUE"

Author:
Roland Praml, Foconis Analytics GmbH
  • Constructor Details

    • RhinoProperties

      public RhinoProperties()
  • Method Details

    • loadDefaults

      public void loadDefaults()
      Load properties from the default locations.
    • loadFromFile

      public void loadFromFile(File config)
      Loads the configuration from the given file.
    • loadFromClasspath

      public void loadFromClasspath(ClassLoader cl, String location)
      Loads the configuration from classpath.
    • loadFromResource

      public void loadFromResource(URL resource)
      Loads the configuration from the given resource.
    • addConfig

      public void addConfig(Map<?,?> config)
      Adds a config map. Later added configs are overriding previous ones
    • get

      public Object get(String property)
      Tries to find the property in the maps. It tries the property first, then it tries the camel upper version.