Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Definition

The configuration files are the files to add to your container's configuration. It is internally used by some containers and is accessible for you can to add extra files.
Icon

This feature is only available for standalone local containers (i.e., not for existing local containers nor any kind of deployers).

Explanation

In some cases, it is necessary to enrich your container configuration with extra files. This can be done using Cargo's configFiles option, accessible via the Cargo APIs.

The advantage of using this option is that it can replace configuration properties in your files: simply use, for example, @cargo.servlet.port@ to have it replaced with the port on which the Servlet/JSP container is listening to.

Careful with binary files!

Icon

If you want to inject binary configuration files (JAR files, for example), you should use setFileProperty (instead of setConfigFileProperty) with the Java API and <files> and <file> (instead of <configfiles> and <configfile>) with the Maven2/Maven3 plugin.

You might for example want to add the advanced login configuration to your JBoss instance.

Example using the Java API

Icon

The method's name is setConfigFileProperty rather than addConfigFileProperty; but it actually adds files to the configFiles list.

Example using the Maven 2 plugin

More advanced example: adding the jetty-env.xml file

To define a central jetty-env.xml file and reuse it later from your WARs, you can proceed as follows:

  1. Use a standalone or installed local configuration (i.e., not an embedded configuration)

  2. Make sure the property JettyPropertySet.CREATE_CONTEXT_XML (i.e. cargo.jetty.createContextXml) is set to false; so that CARGO doesn't create a context.xml file for your WAR's deployable but rather copies it from the source to the configuration home folder.

  3. For each deployable, make sure the deployable is defined as an expanded WAR; as explained on the Static deployment of expanded WAR page.

  4. Finally, for each deployable, add the following to your local container's configuration:


    ... where webapp-context is the Web application's context

This way:

  • To deploy your WAR, CARGO will copy your WAR's expanded version (i.e., the WAR directory) into the webapps subdirectory of the Jetty configuration
  • Once the WAR is copied, CARGO will also copy the jetty-env.xml file into that WAR's WEB-INF directory

As a reference, please find below the full configuration for Jetty 7.x:

  • No labels