The configuration manager allows you to find files using URL with special prefixes that we describe in details below.
war
: Tries to find the file using the Servlet Context of your
portal.war
or any web applications defined as PortalContainerConfigOwner.
For example, in case of the portal.war
, if the URL is
war:/conf/common/portlet-container-configuration.xml
, it will try to get the file from
portal.war/WEB-INF/conf/common/portlet-container-configuration.xml
.
jar
or classpath: Uses this prefix to find a
file that is accessible using the ClassLoader. For example, jar:/conf/my-file.xml
will be understood as trying to find conf/my-file.xml
from the ClassLoader.
file: Indicates the configuration manager that it needs to interpret the URL as an
absolute path. For example, file:///path/to/my/file.xml
will be understood as
an absolute path.
Without prefixes: Is understood as a relative path from the parent directory
of the last processed configuration file. For example, if the configuration manager is processing the file corresonding
to the URL file:///path/to/my/configuration.xml
and in this file you import
dir/to/foo.xml
, the configuration manager will try to get the file from
file:///path/to/my/dir/to/foo.xml
. Please note that it works also for other prefixes.
In case you use the configuration manager in a component to get a file like the example below, it will depend on the mode and will be relative to the following directories:
//cmanager is org.exoplatform.container.configuration.ConfigurationManager instance
InputStream is = cmanager.getInputStream("war:/conf/common/locales-config.xml");
In standalone mode: It will be a relative path where the exo-configuration.xml
file can be found.
The file is first checked in the user directory, if it cannot be found there, it will be checked
in the exo configuration directory. If it still cannot be found, it will be checked in the ClassLoader.
In portal mode: It will be a relative path to the exo configuration directory in case of the
RootContainer (assuming that the configuration.xml
file exists there; otherwise it would be hard to know) and from
${exo-configuration-directory}/portal/${portal-container-name}
in case of the PortalContainer
(assuming that a configuration.xml
file exists there; otherwise it would be hard to know).
For more details about the exo configuration directory please refer to the Configuration Retrieval section.