Definition
Properties to configure a container (request port, shutdown port, logging level, threads, etc)
Explanations
It is possible to set container configuration properties using the Cargo API. These properties are applied to a Configuration.
There are 2 kinds of properties:
- General properties
- Container-specific properties. See each container's page for a list of all the properties it supports.
Some general properties:
Property name
|
Java constant (for the Java API)
|
Description
|
Valid values
|
Default value
|
Examples
|
cargo.hostname
|
GeneralPropertySet.HOSTNAME
|
Host name on which the container listens to
|
string
|
localhost
|
myserver
|
cargo.jvmargs
|
GeneralPropertySet.JVMARGS
|
JVM args to be used when starting and stopping containers
|
string
|
N/A
|
-Xmx500m
|
cargo.start.jvmargs
|
GeneralPropertySet.START_JVMARGS
|
JVM args to be used only when starting containers
|
string |
N/A
|
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=10000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
|
cargo.logging
|
GeneralPropertySet.LOGGING
|
Level representing the quantity of information we wish to log
|
low , medium or high
|
medium
|
high
|
cargo.protocol
|
GeneralPropertySet.PROTOCOL
|
Protocol on which the container is listening to
|
http or https
|
http
|
http
|
cargo.remote.password
|
RemotePropertySet.PASSWORD
|
Password to use to authenticate against a remote container (when deploying for example)
|
string
|
Depends on the container
|
manager
|
cargo.remote.username
|
RemotePropertySet.USERNAME
|
Username to use to authenticate against a remote container (when deploying for example)
|
string
|
Depends on the container
|
system
|
cargo.rmi.port
|
GeneralPropertySet.RMI_PORT
|
The port to use when communicating with this server, for example to start and stop it
|
integer
|
Depends on the container
|
1099
|
cargo.servlet.port
|
ServletPropertySet.PORT
|
Port on which the Servlet/JSP container listens to
|
integer
|
8080
|
8280
|
cargo.servlet.users
|
ServletPropertySet.USERS
|
Allow defining users, passwords and map to roles. Note that having no roles at all for a user is allowed.
Users can be also set using dedicated Maven 3 goals or Ant tags, see chapters with Maven 3 plugin and Ant tasks' documentation.
|
string
|
N/A
|
name1:pwd1:role11,...,role1N|name2:pwd2:role21,...,role2N|...
|
Support Matrix
Java API
Example of starting Tomcat 5.x on port 8081:
Configuration configuration =
new Tomcat5xStandaloneLocalConfiguration("target/tomcat5x"));
configuration.setProperty(ServletPropertySet.PORT, "8081");
[...]
You can check if a configuration supports a given property by using Configuration.getCapability().supportsProperty(String propertyName) .
For example if you want to check if the configuration supports setting the port property:
boolean isPropertySupported = configuration.getCapability().supportsProperty(ServletPropertySet.PORT);
Ant Task
Example of starting Tomcat 5.x on port 8081:
<cargo containerId="tomcat5x" home="c:/apps/jakarta-tomcat-5.0.29" action="start">
<configuration>
<property name="cargo.servlet.port" value="8081"/>
</configuration>
</cargo>
Maven Plugin
Example of starting Tomcat 5.x on port 8081:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo.maven3</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat5x</containerId>
[...]
</container>
<configuration>
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
</properties>
</configuration>
[...]
</configuration>
</plugin>
</plugins>
</build>
Using Java properties
All configuration properties (be it with the Java API, Ant tasks or Maven 3 goals) can also be overriden using Java properties.
For example, with the Maven 3 plugin:
mvn -Dcargo.servlet.port=8082 cargo:start
|