blob: 802c5d30e7284d82bf6bb1fc20f2f61530e35e17 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="configuring">
<title>Configuration</title>
<titleabbrev>Configuration</titleabbrev>
<para>You use configuration files in the <literal>$SERVER_HOME/configuration</literal> directory to configure @project.name@. You can also configure the OSGi framework using files the same <literal>$SERVER_HOME/configuration</literal> directory. This section divides the configuration of the server into the following high-level tasks:</para>
<itemizedlist>
<listitem><para><link linkend="configuring-osgi-framework">Configuring the OSGi framework</link></para></listitem>
<listitem><para><link linkend="configuring-framework-extensions">Configuring framework extensions and fragments on the system bundle</link></para></listitem>
<listitem><para><link linkend="configuring-serviceability">Configuring serviceability</link></para></listitem>
<listitem><para><link linkend="configuring-provisioning-repository">Configuring the local provisioning repository</link></para></listitem>
<listitem><para><link linkend="configuring-hosted-repo">Configuring the hosted repository</link></para></listitem>
<listitem><para><link linkend="configuring-kernel">Configuring the kernel and User Region</link></para></listitem>
<listitem><para><link linkend="configuring-tomcat">Configuring the embedded Tomcat servlet container</link></para></listitem>
<listitem><para><link linkend="configuring-web">Configuring the web integration layer</link></para></listitem>
<listitem><para><link linkend="configuring-jetty">Configuring the embedded Jetty servlet container</link></para></listitem>
</itemizedlist>
<note>
<title>Why is there both a config and a configuration directory?</title>
<para>The <emphasis>config</emphasis> directory has always contained @project.name@ configuration files. When @nano.product.name@ and its support for p2 provisioning was introduced in @project.name@ 3.5.0, a <emphasis>configuration</emphasis> directory replaced the old <emphasis>config</emphasis> one. Now all @project.name@ configurations are assembled in that directory providing a single point of configuration. The directory name <emphasis>configuration</emphasis> in the installation's root is used by default in p2 to configure the OSGi framework during provisioning.</para>
<para>This chapter makes it clear which configuration goes in each directory.</para>
</note>
<note>Sections 4-6 and 8-9 does not apply for @nano.product.name@.</note>
<section id="configuring-osgi-framework" >
<title>Configuring the OSGi Framework</title>
<para>
This section provides information about configuring the OSGi framework by updating the following files in the <literal>$SERVER_HOME/configuration</literal> directory:
</para>
<table id="configuring-osgi-framework-table" colsep="1" frame="all" rowsep="1">
<title>OSGi Framework Configuration Files </title>
<tgroup cols="3">
<thead>
<row>
<entry>Property File</entry>
<entry>Description</entry>
<entry>Location</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>config.ini</literal></entry>
<entry>Configures <link linkend="configuring-framework-properties">OSGi framework properties</link>.</entry>
<entry>$SERVER_HOME/configuration</entry>
</row>
<row>
<entry><literal>bundles.info</literal></entry>
<entry>Configures <link linkend="configuring-framework-bundles">OSGi framework bundles</link>.</entry>
<entry>$SERVER_HOME/configuration/org.eclipse.equinox.simpleconfigurator</entry>
</row>
<row>
<entry><literal>java6-server.profile</literal></entry>
<entry>Configures the <link linkend="configuring-framework-profile">OSGi framework profile</link>.</entry>
<entry>$SERVER_HOME/configuration</entry>
</row>
</tbody>
</tgroup>
</table>
<section id="configuring-framework-properties">
<title>Configuring OSGi Framework Properties</title>
<para>
You specify the framework properties in the <literal>$SERVER_HOME/configuration/config.ini</literal> file. The
properties most relevant to users are described in the following table.
</para>
<para>
<emphasis role="bold">WARNING:</emphasis> We strongly recommend that you update only the
properties below; updating other properties could cause @project.name@
to fail.
</para>
<table id="configuring-framework-properties-table" colsep="1" frame="all" rowsep="1">
<title>Framework Properties</title>
<tgroup cols="2">
<thead>
<row>
<entry>Property</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>org.eclipse.virgo.kernel.startup.wait.limit</literal></entry>
<entry>
Specifies the amount of time, in seconds, after which various operations time out out while trying to start the kernel.
The default value is 180.
</entry>
</row>
<row>
<entry><literal>org.eclipse.virgo.suppress.heap.dumps</literal></entry>
<entry>
Set to 'false' by default this property will prevent heap dumps being contributed to dumps taken during a
First Failure Data Capture (FFDC) event. When the heap dumps are produced they will be located along with
the other dump artifacts in the <literal>$SERVER_HOME/serviceability/dump/</literal> folder.
</entry>
</row>
<row>
<entry><literal>osgi.java.profile</literal></entry>
<entry>
Specifies the profile to use using a <literal>file:</literal> URI with default value
<literal>file:configuration/java6-server.profile</literal>.
</entry>
</row>
<row>
<entry><literal>osgi.bundlefile.limit</literal></entry>
<entry>
Specifies a limit on the number of jar files the framework will keep open.
The minimum value allowed is 10. Any value less than 10 will disable the bundle file limit, making the the number of jar files the framework keeps open unlimited.
By default the value is 100.
Increase the default value if you have many jar files in the bundle class path, expect a lot of file system operations etc.
</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section id="configuring-framework-bundles">
<title>Configuring OSGi Framework Bundles</title>
<para>
You specify the framework bundles in the <literal>$SERVER_HOME/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info</literal> file. The syntax
that is accepted for listing bundles there is:
<screen>&lt;bsn&gt;,&lt;version&gt;,&lt;jar-location&gt;,&lt;start-level&gt;,&lt;toStart?&gt;
bsn - the bundle's symbolic name string
version - the bundle's version string
jar-location - relative or absolute path to the jar file
start-level - a digit indicating the bundle's start level
toStart? - true or false value indicating whether a bundle should be started or not</screen>
<para>Here's an example:</para>
<screen>org.eclipse.virgo.util.osgi,3.1.0.BUILD-20111031165127,plugins/org.eclipse.virgo.util.osgi_3.1.0.BUILD-20111031165127.jar,4,true</screen>
</para>
<para>
<emphasis role="bold">WARNING:</emphasis> We strongly recommend that you don't remove bundles already present in your bundles.info file as that may break your server. Add bundles here only if absolutely necessary.
</para>
</section>
<section id="configuring-framework-profile">
<title>Configuring OSGi Framework Profile</title>
<para>
You specify the framework profile in the <literal>$SERVER_HOME/configuration/java6-server.profile</literal> file. The
properties most relevant to users are described in the following table.
</para>
<para>
<emphasis role="bold">WARNING:</emphasis> We advise you not to change the framework profile unless you are sure you know exactly what
you are doing; updating the profile could cause @project.name@ to fail.
</para>
<table id="configuring-framework-profile-table" colsep="1" frame="all" rowsep="1">
<title>Framework Profile Properties</title>
<tgroup cols="2">
<thead>
<row>
<entry>Property</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>org.osgi.framework.bootdelegation</literal></entry>
<entry>
<para>
This property specifies the packages which are loaded by delegation to the application class loader.
Bundles can load classes belonging to these packages without importing the packages.
The <literal>.*</literal> wildcard matches any package suffix. <literal>java.*</literal> is always
boot delegated and must not be specified in this property.
</para>
<para>
A common reason for adding packages to this property is to run @project.name@ under a performance profiler.
</para>
</entry>
</row>
<row>
<entry><literal>org.osgi.framework.system.packages</literal></entry>
<entry>
<para>
This property specifies the packages which are exported by the system bundle.
</para>
<para>
Although the system bundle is typically imported into the User Region, any additional packages will not be
visible in the User Region unless you also import them using the <literal>packagedImports</literal> property.
See <link linkend="configuring-user-region">Configuring the User Region</link> for instructions.
</para>
<para>
It is very occasionally necessary to extend the set, for example when configuring email logging appenders since the
implementation of <literal>javax.mail</literal> is intimately related to the implementation of
<literal>javax.activation</literal>.
</para>
<para>
To make the corresponding classes available for loading, the relevant JAR file(s) should be placed in
<literal>$SERVER_HOME/lib</literal> so that they will be added to the application class path.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section id="configuring-framework-extensions" >
<title>Configuring Framework Extensions and Fragments on the System Bundle</title>
<para>
This section provides information about configuring framework extensions and fragments on the system bundle. Deployment of such bundles is not allowed in
@project.name@. This is because by refreshing or uninstalling them the system.bundle is also refreshed, which causes @project.name@ to crash.
</para>
<para>
<emphasis role="bold">NOTE:</emphasis> This only applies for fragments on the system bundle. All other fragment bundles have no deployment restrictions.
</para>
<para>
Generally it's best to avoid usage of such fragment bundles as they are a common OSGi framework issue and often require restarting the framework.
However sometimes there are no other options and one has to use framework extensions or fragments on the system bundle.
</para>
<para>
You can configure framework extensions and system bundle fragments as follows:
</para>
<para>
<emphasis role="bold">1.</emphasis> Place your fragment bundle in the <literal>/plugins</literal> directory of your @project.name@ installation.
<para>
Lets say we have bundle with
</para>
<programlisting>
symbolic name: <emphasis>testFragment</emphasis>, version: <emphasis>1.0.0</emphasis> and filename: <emphasis>testFragmentBinary_1.0.0.jar</emphasis>
</programlisting>
</para>
<para>
<emphasis role="bold">2.</emphasis> Configure the <literal>bundles.info</literal> file in <literal>/configuration/org.eclipse.equinox.simpleconfigurator</literal> to include the
just copied fragment or framework extension bundle.
<para>
Add a line at the end of the <literal>bundles.info</literal> file similar to this one:
</para>
<programlisting>
<emphasis>testFragment,1.0.0,plugins/testFragmentBinary_1.0.0.jar,4,false</emphasis>
</programlisting>
</para>
<para>
<emphasis role="bold">3.</emphasis> Configure the <literal>org.eclipse.virgo.kernel.userregion.properties</literal> file in <literal>/configuration</literal> folder to import the fragment bundle or framework extension in the User Region.
<para>
Add to the <literal>bundleImports</literal> property a new line describing the fragment bundle using its symbolic name and version.
</para>
<programlisting>
bundleImports = org.eclipse.osgi;bundle-version="0",<emphasis role="bold">testFragment;bundle-version="0"</emphasis>
</programlisting>
</para>
</section>
<section id="configuring-serviceability">
<title>Configuring Serviceability and Diagnostics</title>
<para>The serviceability features of @project.name@ allow you to gather and view data and information that you can then use to diagnose problems and failures. Serviceability data includes:</para>
<itemizedlist>
<listitem><para>
Service dumps: Contain a snapshot of all the important state from the running @project.name@ instance when an internal failure or thread deadlock is detected.
</para>
<para>You configure service dumps for @project.name@ using the <link linkend="configuring-serviceability-medic">org.eclipse.virgo.medic.properties</link> file in the <literal>$SERVER_HOME/configuration</literal> directory. This file also includes some additional logging configuration.</para>
</listitem>
<listitem><para>
Event logs and server/application (trace) logging: Logging support in @project.name@ is based on <ulink url="http://logback.qos.ch/">Logback</ulink>. This means that you have complete control over the format of log output and have the complete range of Logback's appenders available for your use.
</para>
<para>You configure logging for @project.name@ using the <link linkend="configuring-serviceability-logback">serviceability.xml</link> file in the <literal>$SERVER_HOME/configuration</literal> directory. This file is essentially the Logback <literal>logback.xml</literal> (or <literal>logback-test.xml</literal>) configuration file but renamed for @project.name@. </para>
</listitem>
</itemizedlist>
<para>For additional conceptual information about the serviceability subsystem, see <xref linkend="serviceability" />. </para>
<section id="configuring-serviceability-medic">
<title>The org.eclipse.virgo.medic.properties File</title>
<para>The <literal>$SERVER_HOME/configuration/org.eclipse.virgo.medic.properties</literal> file configures @project.name@ service dumps and whether you want to capture <literal>System.out</literal> and <literal>System.err</literal> output to your application's trace file. </para>
<para>The following table describes the properties you can include in the <literal>$SERVER_HOME/configuration/org.eclipse.virgo.medic.properties</literal> file. This file configures serviceability properties that @project.name@ includes in addition to those supplied by the Logback, configured in the <literal>serviceability.xml</literal> file.</para>
<table id="medic-properties-table" colsep="1" frame="all" rowsep="1">
<title>Serviceability Properties</title>
<tgroup cols="2">
<thead>
<row>
<entry>Property</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>dump.root.directory</literal></entry>
<entry>Specifies the directory to which @project.name@ writes the service dumps. The directory name is relative to <literal>$SERVER_HOME</literal>. </entry>
</row>
<row>
<entry><literal>log.wrapSysOut</literal></entry>
<entry>Specifies whether you want to capture <literal>System.out</literal> output from your applications to the application trace file. The output is logged by @project.name@'s root logger, which captures <literal>INFO</literal> level and above.
<para>Valid values for this property are <literal>true</literal> to capture <literal>System.out</literal> output, or <literal>false</literal> to disable the capture.</para>
<para>For more information, see <link linkend="sysout-and-syserr">System.out and System.err</link>.</para>
</entry>
</row>
<row>
<entry><literal>log.wrapSysErr</literal></entry>
<entry>Specifies whether you want to capture <literal>System.err</literal> output from your applications to the application trace file. The output is logged by @project.name@'s root logger, which captures <literal>INFO</literal> level and above.
<para>Valid values for this property are <literal>true</literal> to capture <literal>System.err</literal> output, or <literal>false</literal> to disable the capture.</para>
<para>For more information, see <link linkend="sysout-and-syserr">System.out and System.err</link>.</para>
</entry>
</row>
<row>
<entry><literal>log.jul.consoleHandler</literal></entry>
<entry>Specifies whether you want to use the <literal>ConsoleHandler</literal> of Java Util Logging. The default JVM configuration uses the handler to write logs to <literal>System.err</literal>.
<para>Valid values for this property are <literal>true</literal> to enable <literal>ConsoleHandler</literal> output, or <literal>false</literal> to disable it. The default value is <literal>false</literal>.</para>
<para>For more information, see <ulink url="http://download.oracle.com/javase/6/docs/technotes/guides/logging/overview.html">Java Logging Overview</ulink>.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section id="configuring-serviceability-logback">
<title>The serviceability.xml File</title>
<para>Logging support in @project.name@ is based on <ulink url="http://logback.qos.ch/">Logback</ulink>, which is a successor of the log4j project. The Logback logging framework is faster, more reliable, and easier to use than log4j and certain other logging systems.</para>
<para>You configure logging for @project.name@ using the <literal>$SERVER_HOME/configuration/serviceability.xml</literal> file. This file is the standard Logback <literal>logback.xml</literal> or <literal>logback-test.xml</literal> configuration file, but renamed for @project.name@. </para>
<para>The following listing shows the default <literal>serviceability.xml</literal> file in a freshly-installed @project.name@; see the text after the listing for a brief overview of the file:</para>
<programlisting language="xml"><![CDATA[<configuration>
<jmxConfigurator />
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
<appender name="SIFTED_LOG_FILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<Key>applicationName</Key>
<DefaultValue>virgo-server</DefaultValue>
</discriminator>
<sift>
<appender name="${applicationName}_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>serviceability/logs/${applicationName}/log.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>serviceability/logs/${applicationName}/log_%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>4</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-5level %-28.28thread %-64.64logger{64} %X{medic.eventCode} %msg %ex%n</Pattern>
</encoder>
</appender>
</sift>
</appender>
<appender name="LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>serviceability/logs/log.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>serviceability/logs/log_%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>4</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-5level %-28.28thread %-64.64logger{64} %X{medic.eventCode} %msg %ex%n</Pattern>
</encoder>
</appender>
<appender name="EVENT_LOG_STDOUT" class="org.eclipse.virgo.medic.log.logback.ReroutingAwareConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-28.28thread &lt;%X{medic.eventCode}&gt; %msg %ex%n</Pattern>
</encoder>
</appender>
<appender name="EVENT_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>serviceability/eventlogs/eventlog.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>serviceability/eventlogs/eventlog_%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>4</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-28.28thread &lt;%X{medic.eventCode}&gt; %msg %ex%n</Pattern>
</encoder>
</appender>
<logger level="INFO" additivity="false" name="org.eclipse.virgo.medic.eventlog.localized">
<appender-ref ref="EVENT_LOG_STDOUT" />
<appender-ref ref="EVENT_LOG_FILE" />
</logger>
<logger level="INFO" additivity="false" name="org.eclipse.virgo.medic.eventlog.default">
<appender-ref ref="SIFTED_LOG_FILE" />
<appender-ref ref="LOG_FILE" />
</logger>
<root level="INFO">
<appender-ref ref="SIFTED_LOG_FILE" />
<appender-ref ref="LOG_FILE" />
</root>
</configuration>]]></programlisting>
<para>Logback allows @project.name@ to use logger, appender, and encoder (layout) objects to log messages according to message type and level and to format these messages and define where they are written. The default <literal>serviceability.xml</literal> file shown above includes four appenders and three loggers (two user and one root.)</para>
<para>The main information to get from this file is that @project.name@ writes log messages to four different locations that map to the four appenders:</para>
<itemizedlist>
<listitem><para>The <literal>jmxConfigurator</literal> provides a possibility to configure logback via JMX. For more information see <ulink url="http://logback.qos.ch/manual/jmxConfig.html">JMX Configurator</ulink> documentation.</para></listitem>
<listitem><para>The <literal>contextListener</literal> propagates the changes made to the levels of logback loggers to Java Util Logging (JUL). For more information see <ulink url="http://logback.qos.ch/manual/configuration.html#LevelChangePropagator">LevelChangePropagator</ulink> documentation.</para> </listitem>
<listitem><para>The <literal>SIFTED_LOG_FILE</literal> appender logs both global and application-specific messages to the <literal>$SERVER_HOME/serviceability/logs/</literal><emphasis><literal>applicationName</literal></emphasis><literal>/log.log</literal> file, where <emphasis><literal>applicationName</literal></emphasis> refers to the name of the application. The log messages for @project.name@ itself are logged to the <literal>$SERVER_HOME/serviceability/logs/virgo-server/log.log</literal> file. Because this appender creates different log files for each application, it is called a <emphasis>sifting appender</emphasis>. </para>
<para>
The default behaviour of these trace files is that, once <literal>log.log</literal> reaches a 10Mb limit, it rolls into a series of files named
<literal>log_</literal><emphasis>i</emphasis><literal>.log</literal> where <emphasis>i</emphasis> ranges from 1 to 4, and logging continues in
a new <literal>log.log</literal> file. This is called its <emphasis>rolling policy</emphasis>.
</para>
<para>The <literal>&lt;Pattern&gt;</literal> element defines the format of each log message; messages include the timestamp, the thread that generated the log message, the context-specific event code, and a stack trace of the exception, if any. For example:</para>
<para><literal>[2008-05-15 09:09:46.940] server-dm-2 org.apache.coyote.http11.Http11Protocol I Initializing Coyote HTTP/1.1 on http-48080</literal></para>
</listitem>
<listitem><para>The <literal>LOG_FILE</literal> appender is very similar to the first one, but it logs <emphasis>all</emphasis> log messages to the <literal>$SERVER_HOME/serviceability/log/log.log</literal> file rather than sifting application-specific messages to their own log file. The rolling policy and message format for this appender is similar to that of the <literal>SIFTED_LOG_FILE</literal> appender.</para></listitem>
<listitem><para>The <literal>EVENT_LOG_STDOUT</literal> appender does not log messages to a file, but rather to the console window from which you started @project.name@. For example:</para>
<para><literal>[2010-10-25 16:20:49.367] Thread-3 &lt;WE0000I&gt; Starting web bundle 'org.eclipse.virgo.apps.admin.web' version '2.1.0.RELEASE' with context path '/admin'.</literal></para>
</listitem>
<listitem><para>The <literal>EVENT_LOG_FILE</literal> appender logs only important events to the <literal>$SERVER_HOME/serviceability/eventlogs/eventlog.log</literal> file, and thus the volume of information is much lower than with the first two appenders. The rolling policy for the event log is the same as with the first two appenders, but the format of the messages is similar to that of the <literal>EVENT_LOG_STDOUT</literal> appender. </para> </listitem>
</itemizedlist>
<para>The loggers and root logger specify the level of log that is written for each of the referenced appenders.</para>
<para>Typically, the default logging configuration as specified by the <literal>serviceability.xml</literal> file is adequate for all @project.name@ environments. However, if you want to customize logging further, you can edit this file as well as the <literal>org.eclipse.virgo.medic.properties</literal>. See the <ulink url="http://logback.qos.ch/manual/index.html">logback documentation</ulink> for detailed information about the architecture and the configuration of Logback.</para>
</section>
</section>
<section id="configuring-provisioning-repository">
<title>Configuring the Local Provisioning Repository</title>
<para>
You configure the locations that @project.name@ includes in its provisioning repository
by editing the <literal>org.eclipse.virgo.repository.properties</literal> file in the <literal>$SERVER_HOME/configuration</literal> directory.
</para>
<para>When you specify a property in the file, use the format <literal>repository-name.property=value</literal>, where:
<itemizedlist>
<listitem><para><literal>repository-name</literal> refers to the name of the local repository.</para></listitem>
<listitem><para><literal>property</literal> refers to the name of a particular property.</para></listitem>
<listitem><para><literal>value</literal> refers to the value of the property.</para></listitem>
</itemizedlist>
</para>
<para>For example, <literal>ext.type=external</literal> specifies that the <literal>type</literal> property of the repository
with name <literal>ext</literal> is <literal>external</literal>.
</para>
<para>
The <literal>chain</literal> property specifies the order in which @project.name@ searches the individual repositories
when it looks for dependencies.
The <literal>chain</literal> property uses the names of the individual repositories as specified in the individual repository properties;
for example, in the property <literal>ext.type=external</literal>, the name of the repository is <literal>ext</literal>.
</para>
<para>
The default repository configuration for a newly installed @project.name@ instance is as follows:
<programlisting><![CDATA[ext.type=external
ext.searchPattern=repository/ext/{artifact}
usr.type=watched
usr.watchDirectory=repository/usr
chain=ext,usr]]></programlisting>
</para>
<para>
The default configuration shown above has two searchpaths corresponding to the two default sub-directories of the <literal>$SERVER_HOME/repository</literal> directory created when you first install @project.name@: <literal>ext</literal> and <literal>usr</literal>. @project.name@ searches each of these individual repositories when locating entries for inclusion in the repository. </para>
<para>
The <literal>chain</literal> property shows the order in which @project.name@ searches the individual repositories: first <literal>ext</literal> and then <literal>usr</literal>.
</para>
<para>
The following table lists all the available properties that you can use to configure an individual repository.
Individual repositories as well as the repository search chain are configured in the file
<literal>$SERVER_HOME/configuration/org.eclipse.virgo.repository.properties</literal>.
<table id="repository-options-table" colsep="1" frame="all" rowsep="1">
<title>Repository Properties</title>
<tgroup cols="3">
<thead>
<row>
<entry>
Property
</entry>
<entry>
Description
</entry>
<entry>
Default Value
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.type</literal>
</entry>
<entry>
<para>
Specifies the type of path. You can set this property to one of the following three valid values:
<itemizedlist>
<listitem>
<para>
<literal>external</literal>: Specifies that this path points to a number of directories that satisfy a given search pattern
and are local to the current @project.name@ instance.
Use the <literal>searchPattern</literal> property to specify the directory search pattern.
</para>
</listitem>
<listitem>
<para>
<literal>watched</literal>: Specifies that this path points to a single directory, local to the current @project.name@ instance.
@project.name@ regularly scans watched repositories so it automatically picks up any changes to the artifacts in the directory at runtime.
@project.name@ also scans its local watched repositories when deploying any artifact.
Use the <literal>watchDirectory</literal> property to specify the watched directory
and the <literal>watchInterval</literal> property to specify how often @project.name@ checks the directory.
</para>
</listitem>
<listitem>
<para>
<literal>remote</literal>: Specifies that the path points to a remotely-hosted repository,
hosted by a remote instance of @tomcat.product.name@.
Use the <literal>uri</literal> property to specify the full URI of the remote repository.
You can also specify the optional <literal>indexRefreshInterval</literal> property.
</para>
</listitem>
</itemizedlist>
</para>
<para>
See <link linkend="configuring-repository-watched-versus-external">Watched or External Repository?</link>
for additional information about when to configure watched or external repositories for your particular environment.
</para>
</entry>
<entry>
<emphasis>no default</emphasis>
</entry>
</row>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.searchPattern</literal>
</entry>
<entry>
<para>
Specifies the pattern that an external repository uses when deciding which local directories it should search
when identifying artifacts. Use this property together with <emphasis><literal>repository-name</literal></emphasis><literal>.type=external</literal>.
See <link linkend="configuring-provisioning-repository-search-paths" >Search Paths: Additional Information</link>
for detailed information about specifying a search pattern.
</para>
</entry>
<entry>
<emphasis>no default</emphasis>
</entry>
</row>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.watchDirectory</literal>
</entry>
<entry>
<para>
Specifies the single directory of a watched repository.
You can specify either an absolute or relative pathname for the directory.
If you specify a relative pathname, it is relative to the root of the @project.name@ installation (<literal>$SERVER_HOME</literal>).
Use this property together with <emphasis><literal>repository-name</literal></emphasis><literal>.type=watched</literal>.
</para>
</entry>
<entry>
<emphasis>no default</emphasis>
</entry>
</row>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.watchInterval</literal>
</entry>
<entry>
<para>
Specifies the interval in seconds between checks of a watched directory by a watched repository.
Use this property together with <emphasis><literal>repository-name</literal></emphasis><literal>.type=watched</literal>.
</para>
</entry>
<entry>
<literal>5</literal>
</entry>
</row>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.uri</literal>
</entry>
<entry>
<para>
Specifies the URI of the hosted repository to which a remote repository connects.
The value of this property takes the following format:
</para>
<para> <literal>http://</literal><emphasis><literal>host</literal></emphasis><literal>:</literal><emphasis><literal>port</literal></emphasis><literal>/org.eclipse.virgo.apps.repository/</literal><emphasis><literal>remote-repository-name</literal></emphasis>
</para>
<para>
where:
<itemizedlist>
<listitem>
<para>
<emphasis><literal>host</literal></emphasis> refers to the computer on which the remote @tomcat.product.name.short@
instance hosts the remote repository.
</para>
</listitem>
<listitem>
<para>
<emphasis><literal>port</literal></emphasis> refers to a Tomcat listener port of the remote @tomcat.product.name.short@
instance which hosts the remote repository.
</para>
</listitem>
<listitem>
<para>
<emphasis><literal>remote-repository-name</literal></emphasis> refers to the name of the remote repository,
as specified in the <literal>org.eclipse.virgo.apps.repository.properties</literal> file of the remote @tomcat.product.name.short@ instance.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Use this property together with <emphasis><literal>repository-name</literal></emphasis><literal>.type=remote</literal>.
</para>
</entry>
<entry>
<emphasis>no default</emphasis>
</entry>
</row>
<row>
<entry>
<emphasis><literal>repository-name</literal></emphasis><literal>.indexRefreshInterval</literal>
</entry>
<entry>
<para>
Specifies the interval in seconds between checks by a remote repository that
its local copy of the hosted repository index is up-to-date
(a remote repository acts as a proxy for a hosted repository and thus it holds a local copy of the hosted repository&rsquo;s index).
</para>
<para>
Use this property together with <emphasis><literal>repository-name</literal></emphasis><literal>.type=remote</literal>.
</para>
</entry>
<entry>
<literal>5</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<section id="configuring-repository-watched-versus-external">
<title>Should I Configure a Watched or External Repository?</title>
<para>The main difference between a watched and an external repository is that @project.name@ regularly scans watched directories
and automatically picks up any changed artifacts,
while @project.name@ scans external directories only at startup, and then only if there is no cached index available.
This means that @project.name@ always performs a scan of an external repository when you start the server
with the <literal>-clean</literal> (as this deletes the index) and only scans during a normal startup if the index isn&rsquo;t there because,
for example, this is the first time you start the server.
</para>
<para>There is a performance cost associated with using a watched repository due to @project.name@ using resources
to scan the directory at the configured interval.
The cost is small if the watched repository contains just a few artifacts; however,
the performance cost increases as the number of artifacts increases.
Note that @project.name@ re-scans its local watched repositories when deploying any artifact, so the scanning interval
can be configured to be relatively long.
</para>
<para> For this reason, we recommend that you put most of your dependencies in external repositories,
even when in development mode.
If you make any changes to the artifacts in the external repositories,
remember to restart @project.name@ with the <literal>-clean</literal> option so that the server picks up any changes.
Use watched directories for artifacts that you are prototyping, actively updating, or when adding new dependencies
so that @project.name@ quickly and easily picks them up.
To increase performance even during development, however, you can use an external repository for most of your dependencies,
in particular the ones that are fairly static.
</para>
<para>In production environments, where dependencies should not change,
we recommend that you use <emphasis>only</emphasis> external repositories.
</para>
</section>
<section id="configuring-provisioning-repository-search-paths">
<title>Search Paths: Additional Information</title>
<para>
The <emphasis><literal>repository-name</literal></emphasis><literal>.searchPattern</literal> and
<emphasis><literal>repository-name</literal></emphasis><literal>.watchDirectory</literal> properties specify search paths
for external and watched repositories, respectively,
that define a physical location that @project.name@ searches when looking for a library or bundle dependency.
If a search path is relative, its location is relative to the root of the installation,
in other words, the <literal>$SERVER_HOME</literal> directory.
</para>
<section id="configuring-provisioning-repository-search-paths-wildcards">
<title>Using Wildcards</title>
<para>
Search paths specified with the <emphasis><literal>repository-name</literal></emphasis><literal>.searchPattern</literal> property
provide support for wildcards.
In the entries above, the path segments surrounded by curly braces,
for example <literal>{bundle}</literal> and <literal>{library}</literal>,
are wildcards entries for a directory with any name.
Allowing wildcards to be named in this way is intended to improve the readability of search path configuration.
</para>
<para>
In addition to supporting the above-described form of wildcards, @project.name@ also supports Ant-style paths,
that is <literal>*</literal> and <literal>**</literal> can be used to represent any directory and
any series of directories, respectively.
For example, <literal>repository/usr/{bundle}</literal> and <literal>repository/usr/*</literal>
are equivalent.
</para>
<para>
A common usage of the <literal>**</literal> wildcard is to allow dependencies stored in a directory structure of varying depth,
such as a local Maven repository, to be provisioned by the @project.name@.
</para>
</section>
</section>
<section id="configuring-provisioning-repository-using-system-properties">
<title>Using System Properties</title>
<para>
You can use system properties when specifying the values of the <emphasis><literal>repository-name</literal></emphasis><literal>.searchPattern</literal>,
<emphasis><literal>repository-name</literal></emphasis><literal>.watchDirectory</literal>,
<emphasis><literal>repository-name</literal></emphasis><literal>.watchInterval</literal>,
<emphasis><literal>repository-name</literal></emphasis><literal>.uri</literal>,
and <emphasis><literal>repository-name</literal></emphasis><literal>.indexRefreshInterval</literal>
properties.
You reference system properties as <literal>${system.property.name}</literal>;
for example, a search path of <literal>${user.home}/repository/bundles</literal> references the
<literal>repository/bundles</literal> directory in the user&rsquo;s home directory.
</para>
</section>
<section id="configuring-provisioning-repository-examples">
<title>Example Repository Configurations</title>
<para>
The following examples provide sample configuration that could be used for some common use cases.
</para>
<section id="configuring-provisioning-repository-examples-ivy">
<title>Add an Ivy cache repository</title>
<para>The following example shows how to add an external repository whose location is actually an Ivy cache.</para>
<para><emphasis>Note that Ivy repositories can contain bundles which will conflict with the normal operation of Virgo, so care should
be exercised when adding such an external repository.</emphasis></para>
<programlisting><![CDATA[ext.type=external
ext.searchPattern=repository/ext/{artifact}
usr.type=watched
usr.watchDirectory=repository/usr
ivy-repo.type=external
ivy-repo.searchPattern=${user.home}/.ivy2/cache/{org}/{name}/{version}/{bundle}.jar
chain=ext,usr,ivy-repo]]></programlisting>
</section>
<section id="configuring-provisioning-repository-examples-maven">
<title>Add a Maven local repository</title>
<para>The following example shows how to add an external repository whose location is actually a Maven repository.</para>
<para><emphasis>Note that Maven repositories can contain bundles which will conflict with the normal operation of Virgo, so care should
be exercised when adding such an external repository.</emphasis></para>
<programlisting><![CDATA[ext.type=external
ext.searchPattern=repository/ext/{artifact}
usr.type=watched
usr.watchDirectory=repository/usr
maven-repo.type=external
maven-repo.searchPattern=${user.home}/.m2/repository/**/{bundle}.jar
chain=ext,usr,maven-repo]]></programlisting>
</section>
<section id="configuring-repository-examples-remote-watched">
<title>Add remote and watched repositories</title>
<para>The following example shows the default <literal>org.eclipse.virgo.repository.properties</literal> file
from a freshly-installed @project.name@ instance, but then updated to include new remote and watched repositories.
Both of these repositories are part of the repository chain.
</para>
<para>The remote repository is called <literal>remote-repo</literal>.
The URI of the hosted repository from which <literal>remote-repo</literal> gets its artifacts is
<literal>http://my-host:8080/org.eclipse.virgo.apps.repository/my-hosted-repo</literal>;
this means that there is a @tomcat.product.name.short@ instance running on host <literal>my-host</literal>
whose Tomcat server listens at the default port, <literal>8080</literal>,
and this server instance hosts a repository called <literal>my-hosted-repo</literal>,
configured in the <literal>org.eclipse.virgo.apps.repository.properties</literal> file of the remote server instance.
The remote repository checks for changes in the hosted repository every 30 seconds.
</para>
<para>The watched repository is called <literal>watched-repo</literal> and the directory that holds the artifacts
is <literal>repository/watched</literal>,
relative to the installation directory of the @tomcat.product.name.short@ instance.
The server checks for changes in this watched repository every 5 seconds.
</para>
<programlisting><![CDATA[ext.type=external
ext.searchPattern=repository/ext/{artifact}
usr.type=watched
usr.watchDirectory=repository/usr
remote-repo.type=remote
remote-repo.uri=http://my-host:8080/org.eclipse.virgo.apps.repository/my-hosted-repo
remote-repo.indexRefreshInterval=30
watched-repo.type=watched
watched-repo.watchedDirectory=repository/watched
watched-repo.watchedInterval=5
chain=ext,usr,remote-repo,watched-repo]]></programlisting>
</section>
</section>
</section>
<section id="configuring-hosted-repo">
<title>Configuring a Hosted Repository</title>
<para>You configure a @tomcat.product.name.short@ instance to host a repository
by editing the <literal>$SERVER_HOME/configuration/org.eclipse.virgo.apps.repository.properties</literal> file;
remote clients can then access the artifacts in this hosted repository and use them locally.
</para>
<para>When you specify a property in the file, use the format <literal>repository-name.property=value</literal>, where:
<itemizedlist>
<listitem><para><literal>repository-name</literal> refers to the name of the hosted repository.</para></listitem>
<listitem><para><literal>property</literal> refers to the name of a particular property.</para></listitem>
<listitem><para><literal>value</literal> refers to the value of the property.</para></listitem>
</itemizedlist>
</para>
<para>For example, <literal>my-hosted-repo.type=external</literal> specifies that the <literal>type</literal> property
of the <literal>my-hosted-repo</literal> repository is <literal>external</literal>.
</para>
<para>The following table lists the properties that you can include in the <literal>org.eclipse.virgo.apps.repository.properties</literal> file.
</para>
<table id="hosted-repository-properties-table" colsep="1" frame="all" rowsep="1">
<title>Hosted Repository Properties</title>
<tgroup cols="2">
<thead>
<row>
<entry>Property</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis><literal>repository-name</literal></emphasis><literal>.type</literal></entry>
<entry>Specifies the type of path of the hosted repository.
All paths are local to the current @tomcat.product.name.short@ instance.
You can set this property to one of the following valid values:
<itemizedlist>
<listitem>
<para>
<literal>external</literal>: Specifies that this path points to a number of directories that satisfy a given search pattern.
Use the <literal>searchPattern</literal> property to specify the directory search pattern.
</para>
</listitem>
<listitem>
<para>
<literal>watched</literal>: Specifies that this path points to a single directory.
@project.name@ regularly scans watched repositories so it automatically picks up any changes to the artifacts in the directory at runtime.
Use the <literal>watchDirectory</literal> property to specify the actual watched directory and the <literal>watchInterval</literal> property
to specify how often @tomcat.product.name.short@ checks the directory.
</para>
</listitem>
</itemizedlist>
<para>See <link linkend="configuring-repository-watched-versus-external">Watched or External Repository?</link>
for additional information about when to configure watched or external repositories for your particular environment.
</para>
</entry>
</row>
<row>
<entry><emphasis><literal>repository-name</literal></emphasis><literal>.searchPattern</literal></entry>
<entry> <para>Specifies the pattern that an external hosted repository uses when deciding which
local directories it should search when identifying artifacts.
Use this property when <literal>repository-name.type=external</literal>.
See <link linkend="configuring-provisioning-repository-search-paths" >Search Paths: Additional Information</link>
for detailed information about specifying a search pattern.
</para> </entry>
</row>
<row>
<entry><emphasis><literal>repository-name</literal></emphasis><literal>.watchDirectory</literal></entry>
<entry> <para>Specifies the single directory of a watched hosted repository.
You can specify either an absolute or relative pathname for the directory.
If you specify a relative pathname, it is relative to the root of the @tomcat.product.name.short@ installation (<literal>$SERVER_HOME</literal>).
Use this property when <literal>repository-name.type=watched</literal>.
</para></entry>
</row>
<row>
<entry><emphasis><literal>repository-name</literal></emphasis><literal>.watchInterval</literal></entry>
<entry> <para>Specifies the interval in seconds between checks of a watched directory by a watched hosted repository.
This property is optional. Use this property when <literal>repository-name.type=watched</literal>.
</para> </entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following sample shows a <literal>org.eclipse.virgo.apps.repository.properties</literal> file with a single external repository
called <literal>my-hosted-repo</literal> with search pattern <literal>$SERVER_HOME/repository/hosted/*</literal>.
<programlisting><![CDATA[my-hosted-repo.type=external
my-hosted-repo.searchPattern=repository/hosted/*]]></programlisting>
</para>
<para>See <link linkend="configuring-repository-examples-remote-watched">Example of watched and remote repositories</link>
for details on how a local repository can remotely access the artifacts in this hosted repository.
</para>
</section>
<section id="configuring-kernel" >
<title>Configuring the Kernel and User Region</title>
<para>This section provides information about configuring the @project.name@ kernel and the User Region.</para>
<section id="configuring-kernel-properties">
<title>Configuring the Kernel</title>
<para>To change any of the kernel properties, provide the new value to the startup script. The following table describes all properties.</para>
<table id="configuring-kernel-table" colsep="1" frame="all" rowsep="1">
<title>Kernel Configuration Properties</title>
<tgroup cols="3">
<thead>
<row>
<entry>
Property (prefixed by <literal>org.eclipse.virgo</literal>)
</entry>
<entry>
Description
</entry>
<entry>
Default Value
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<literal>.kernel.home</literal>
</entry>
<entry>
Specifies the location of the @kernel.product.name@.
</entry>
<entry>
<literal>$SERVER_HOME</literal>
</entry>
</row>
<row>
<entry>
<literal>.kernel.config</literal>
</entry>
<entry>
Specifies the location of the @kernel.product.name@ and User Region <link linkend="configuring-kernel-files">configuration files</link>.
The location of the configuration files can also be specified using
<link linkend="starting-stopping-configuration-directory"><literal>-configDir</literal> startup parameter</link>.
</entry>
<entry>
<literal>$SERVER_HOME/configuration</literal>
</entry>
</row>
<row>
<entry>
<literal>.kernel.domain</literal>
</entry>
<entry>
Specifies the <ulink url="http://download.oracle.com/javase/6/docs/api/javax/management/ObjectName.html">JMX domain</ulink> that should be
used by the @kernel.product.name@.
</entry>
<entry>
<literal>org.eclipse.virgo.kernel</literal>
</entry>
</row>
<row>
<entry>
<literal>.kernel.startup.wait.limit</literal>
</entry>
<entry>
Specifies the amount of time, in seconds, after which various operations time out out while trying to start the kernel.
See <link linkend="configuring-framework-properties">Configuring OSGi Framework Properties</link> for the recommended way
to configure this parameter.
</entry>
<entry><literal>180</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section id="configuring-kernel-files">
<title>Configuration Files</title>
<para>The configuration of the @kernel.product.name@ and User Region by default is located in the <literal>$SERVER_HOME/configuration</literal> directory:</para>
<table id="configuring-kernel-files-table" colsep="1" frame="all" rowsep="1">
<title>Kernel Configuration Files </title>
<tgroup cols="2">
<thead>
<row>
<entry>Property File</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>org.eclipse.virgo.kernel.properties</literal></entry>
<entry>Configures <link linkend="configuring-deployment">deployment</link>. </entry>
</row>
<row>
<entry><literal>org.eclipse.virgo.kernel.userregion.properties</literal></entry>
<entry>Configures the <link linkend="configuring-user-region">User Region</link> of @project.name@.</entry>
</row>
<row>
<entry><literal>org.eclipse.virgo.kernel.users.properties</literal></entry>
<entry>Configures the <link linkend="configuring-authentication">users that are allowed to access</link> the Admin Console, and roles to which they map. </entry>
</row>
<row>
<entry><literal>org.eclipse.virgo.kernel.jmxremote.access.properties</literal></entry>
<entry>Configures the <link linkend="configuring-authentication">permissions for users</link> that are allowed to access the Admin Console. </entry>
</row>
<row>
<entry><literal>org.eclipse.virgo.kernel.authentication.config</literal></entry>
<entry>Configures the <link linkend="configuring-authentication">Java Authentication and Authorization Service (JAAS)</link> for the Tomcat server users.</entry>
</row>
<row>
<entry><literal>osgi.console.ssh.properties</literal></entry>
<entry>Configures the kernel SSH console. See <xref linkend="admin-shell-enable"/>.</entry>
</row>
<row>
<entry><literal>osgi.console.telnet.properties</literal></entry>
<entry>Configures the kernel telnet console. See <xref linkend="admin-shell-enable"/>.</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section id="configuring-deployment">
<title>Configuring Deployment</title>
<para>
You can configure various properties of deployment: the pickup directory into which you copy applications for hot-deployment, the deployment timeout,
and whether or not bundles are unpacked during deployment.
</para>
<para>To change any of these properties, edit the <literal>deployer.XXX</literal> properties of the <literal>$SERVER_HOME/configuration/org.eclipse.virgo.kernel.properties</literal> file. The following table describes these properties. </para>
<table id="configuring-deployment-table" colsep="1" frame="all" rowsep="1">
<title>Deployment Configuration Properties</title>
<tgroup cols="3">
<thead>
<row>
<entry>
Property
</entry>
<entry>
Description
</entry>
<entry>
Default Value
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<literal>deployer.pickupDirectory</literal>
</entry>
<entry>
Specifies the absolute or relative path to the pickup directory to which you copy applications for hot-deployment.
Relative paths are relative to <literal>$SERVER_HOME</literal>.
</entry>
<entry>
<literal>./pickup</literal>
</entry>
</row>
<row>
<entry>
<literal>deployer.timeout</literal>
</entry>
<entry>
Specifies the amount of time, in seconds, after which @project.name@ times out while trying to deploy an artifact.
If you want to disable deployment timeout, specify <literal>0</literal>.
</entry>
<entry>
<literal>300</literal>
</entry>
</row>
<row>
<entry>
<literal>deployer.scanIntervalMillis</literal>
</entry>
<entry>
Specifies the scan interval, in milliseconds, used to survey the pickup directory.
</entry>
<entry>
<literal>1000</literal>
</entry>
</row>
<row>
<entry>
<literal>deployer.unpackBundles</literal>
</entry>
<entry>
Determines whether or not bundles (with file extension <literal>.jar</literal> or <literal>.war</literal>) are unpacked
during deployment. The value must be either <literal>true</literal> or <literal>false</literal>.
<para>
If you want to deploy bundles packed, specify <literal>false</literal>.
This option can help alleviate a known issue with <link linkend="long-work-paths">long work directory paths under Windows</link>.
</para>
<para>
Note that web applications may behave differently depending on whether they are deployed packed or unpacked.
Certain servlet API methods return <literal>null</literal> when a web application is deployed packed.
</para>
</entry>
<entry>
<literal>true</literal>
</entry>
</row>
<row>
<entry>
<literal>WABHeaders</literal>
</entry>
<entry>
<para>
This kernel property is only relevant for @nanoweb.product.name@. For the corresponding property in @tomcat.product.name@, see <link linkend="configuring-web">Configuring the Web Integration Layer</link>.
</para>
<para>
Specifies how Web Application Bundle manifest headers are processed.
See "Web Application Manifest Processing" in the
<ulink url="../../virgo-programmer-guide/html/index.html">Programmer Guide</ulink> for details.
</para>
<para>
A value of <literal>strict</literal> causes @nanoweb.product.name@ to interpret certain headers in strict compliance with
the OSGi Web Applications specification if they are not specified.
</para>
<para>
A value of <literal>defaulted</literal> causes @nanoweb.product.name@ to set certain headers to default values if they are not specified.
<emphasis>This value is provided as a migration aid and may not be supported in future releases.</emphasis>
</para>
</entry>
<entry>
<literal>strict</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following listing displays the default configuration distributed with @project.name@; only relevant sections of the <literal>org.eclipse.virgo.kernel.properties</literal> file are shown. </para>
<programlisting><![CDATA[deployer.timeout=300
deployer.pickupDirectory=pickup
deployer.scanIntervalMillis=1000]]></programlisting>
<para>So the default deployment timeout is 300 seconds, the default pickup directory is <literal>$SERVER_HOME/pickup</literal> and the default scan interval is <literal>1000</literal>.
</para>
</section>
<section id="configuring-user-region">
<title>Configuring the User Region</title>
<para>
The User Region is the subsystem of @project.name@ that
supports deployed applications, both your own user applications and
those of the server itself, such as the Admin Console. The User Region
is deliberately isolated from the kernel, which protects the kernel from interference by applications.
</para>
<para>
You configure the User Region by updating properties in the
<literal>$SERVER_HOME/configuration/org.eclipse.virgo.kernel.userregion.properties</literal>
file; these properties are described in the following table.
</para>
<para>
<emphasis role="bold">WARNING:</emphasis>
We strongly recommend that you update only the
<literal>initialArtifacts</literal>
property; updating other properties could cause
@project.name@ to fail. These properties are documented for your
information.
</para>
<table id="configuring-user-region-table" colsep="1" frame="all" rowsep="1">
<title>User Region Configuration Properties</title>
<tgroup cols="2">
<thead>
<row>
<entry>Property</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>baseBundles</literal></entry>
<entry>Specifies the hard-coded list of bundles that @project.name@ installs directly into the User Region.
@project.name@ does not perform any automatic dependency satisfaction for these bundles; in other words, you only get the bundles
in the list and nothing more. </entry>
</row>
<row>
<entry><literal>bundleImports</literal></entry>
<entry>
<para>
Specifies the bundles in the kernel that @project.name@ imports into the User Region so that they are visible to bundles in the User Region.
This property supports an optional <literal>bundle-version</literal> attribute which specifies a version range.
By default only the system bundle is imported.
</para>
<para>
Note that packages exported by these bundles are <emphasis>not</emphasis> automatically made available in the User Region: these must be specified using the
<literal>packageImports</literal> property.
</para>
</entry>
</row>
<row>
<entry><literal>packageImports</literal></entry>
<entry>
<para>
Specifies the packages in the kernel that @project.name@ imports into the User Region so that they are in turn available to be
imported by bundles in the User Region.
This property supports a <literal>.*</literal> wildcard which is expanded based on the packages available in the kernel
when the User Region is created.
For example, <literal>org.eclipse.virgo.util.*</literal> will import all packages that start with
<literal>org.eclipse.virgo.util.</literal> (but <emphasis>not</emphasis> the package <literal>org.eclipse.virgo.util</literal>
which would need to be specified separately to be imported).
</para>
<para>
The property also supports matching attributes such as <literal>version</literal>, <literal>bundle-symbolic-name</literal>,
<literal>bundle-version</literal>, and user-defined attributes. This can be used to import all the packages of a bundle imported using the
<literal>bundleImports</literal> property.
For example the following imports all the packages of the system bundle:
<programlisting><![CDATA[packageImports=*;bundle-symbolic-name="org.eclipse.osgi",\
...]]></programlisting>
Note that if a package is specified more than once in <literal>packageImports</literal>, the last occurrence is used and the earlier
occurrences are ignored.
For this reason, it is recommended that imports specifying matching attributes are placed earlier in the list than other imports so that
if an import is specified with and without matching attributes, the form without the matching attributes is used.
</para>
</entry>
</row>
<row>
<entry><literal>serviceImports</literal></entry>
<entry>Specifies the services in the kernel that are imported into the User Region so they are available to bundles in the User Region. </entry>
</row>
<row>
<entry><literal>serviceExports</literal></entry>
<entry>Specifies the services in the User Region that are exported to the kernel so they are available to bundles in the kernel. </entry>
</row>
<row>
<entry><literal>initialArtifacts</literal></entry>
<entry>
<para>
Specifies the artifacts that @project.name@ deploys into the User Region when the server starts.
@project.name@ performs dependency satisfaction when it deploys these artifacts.
This means that you only need to list the top-level artifacts that you care about; @project.name@ automatically installs,
from the repository, any other artifacts upon which they depend.
</para>
<para>
The artifacts are specified as a comma separated list of URI strings of the form:
<programlisting><![CDATA[repository:type/name[/version]]]></programlisting>
where <literal>type</literal> is the artifact type (e.g. "plan", "par", "bundle",
"configuration"), <literal>name</literal> is the (symbolic) name of the artifact, and, optionally,
<literal>version</literal> is the version of the artifact.
If <literal>version</literal> is omitted and there is at least one artifact in the repository with the given type and name, then the
artifact with the highest version is selected.
So, for example, the following entries are valid:
<programlisting><![CDATA[initialArtifacts=...,\
repository:plan/APlan,\
repository:bundle/ABundle/1.0]]></programlisting>
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<section id="configuring-user-region-consoles">
<title>Configurating User Region Consoles</title>
<para>The configuration of the User Region consoles is located by default in the <literal>$SERVER_HOME/repository/ext</literal> directory:</para>
<table id="configuring-user-region-consoles-table" colsep="1" frame="all" rowsep="1">
<title>User Region Console Configuration Files </title>
<tgroup cols="2">
<thead>
<row>
<entry>Property File</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>osgi.console.ssh.properties</literal></entry>
<entry>Configures the User Region SSH console. See <xref linkend="admin-shell-enable"/>.</entry>
</row>
<row>
<entry><literal>osgi.console.telnet.properties</literal></entry>
<entry>Configures the User Region telnet console. See <xref linkend="admin-shell-enable"/>.</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section id="configuring-authentication">
<title>Configuring Authentication</title>
<para>
@project.name@ uses the
<ulink
url="http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html">Java Authentication and Authorization Service (JAAS)</ulink>
framework to authenticate the administration user that connects to Web
Servers using the Admin Console. This section describes
how the authentication mechanism is configured by default, and the
files that you need to update if you want to change the administration
user, change their password, and so on.
</para>
<para>The <literal>$SERVER_HOME/configuration/org.eclipse.virgo.kernel.authentication.config</literal> file configures the underlying authentication technology for @project.name@. The short file consists of the following entries:</para>
<programlisting>virgo-kernel {
org.eclipse.virgo.kernel.authentication.KernelLoginModule REQUIRED;
};
equinox_console {
org.eclipse.virgo.kernel.authentication.KernelLoginModule REQUIRED;
};</programlisting>
<para>The entry named <literal>virgo-kernel</literal> corresponds to the <literal>&lt;Realm&gt;</literal> element in the <literal>$SERVER_HOME/configuration/tomcat-server.xml</literal> file that configures the JAAS authentication mechanism for the <literal>Catalina</literal> service of the <link linkend="configuring-tomcat">Tomcat servlet container</link>. The <literal>virgo-kernel</literal> entry specifies that the JAAS LoginModule that @project.name@ uses to authenticate users is <literal>org.eclipse.virgo.kernel.authentication.KernelLoginModule</literal> and that this <literal>KernelLoginModule</literal> is required to "succeed" in order for authentication to be considered successful. The <literal>KernelLoginModule</literal> succeeds only if the name and password supplied by the user are the ones it expects. The default administration username/password pair for @tomcat.product.name.short@ is <literal>admin/springsource</literal>. </para>
<para>
The entry named <literal>equinox_console</literal> controls ssh authentication for the Virgo shell. It also uses the <literal>KernelLoginModule</literal>.
</para>
<para>You configure the administration user in the <literal>org.eclipse.virgo.kernel.users.properties</literal> file. The default file for a freshly installed @project.name@ is as follows:</para>
<programlisting>##################
# User definitions
##################
user.admin=springsource
##################
# Role definitions
##################
role.admin=admin</programlisting>
<para>
The administration user that connect to the Admin Console must have the
<literal>admin</literal>
role. The preceding file shows how, by default, the
<literal>admin</literal>
role is assigned the
<literal>admin</literal>
user with password
<literal>springsource</literal>.
</para>
<para>If you want to change the administration user, update the <literal>org.eclipse.virgo.kernel.users.properties</literal> file. For example, if you want the <literal>juliet</literal> user, with password <literal>supersecret</literal>, to be the new adminstration user, update the file as shown:</para>
<programlisting>##################
# User definitions
##################
user.juliet=supersecret
##################
# Role definitions
##################
role.admin=juliet</programlisting>
<para>Be sure to restart @project.name@ after you make this change for it to take effect.</para>
<para>The final file involved in @project.name@ authentication is <literal>$SERVER_HOME/configuration/org.eclipse.virgo.kernel.jmxremote.access.properties</literal>. This file specifies the JMX access privileges that the administration user has; by default they are read and write, as shown in the following listing:</para>
<programlisting>admin=readwrite</programlisting>
<para>
The only other value you can enter is
<literal>readonly</literal>, which means that the adminstration user would only be able to <emphasis>view</emphasis>
information using the Admin Console.
</para>
</section>
</section>
<section id="configuring-tomcat">
<title>Configuring the Embedded Tomcat Servlet Container</title>
<note>@nano.product.name@ uses the default Gemini Web configuration. The details described below may still apply.</note>
<para>
@project.name@
embeds an OSGi-enhanced version of the <ulink url="http://tomcat.apache.org/">Tomcat Servlet Container</ulink>
in order to provide support for deploying Java EE WARs and OSGi <emphasis>Web Application Bundles</emphasis>.
You configure the embedded Servlet container using the standard Apache Tomcat configuration. The main difference is that the configuration file is called <filename>tomcat-server.xml</filename> rather than <literal>server.xml</literal>. As with the other @project.name@ configuration files, the <literal>tomcat-server.xml</literal> file is located in the <literal>$SERVER_HOME/configuration</literal> directory.
Another difference is that not all standard Apache Tomcat configuration is supported in @tomcat.product.name@: the restrictions are described in the
remainder of this section.
</para>
<para>Here's an extract of the default configuration distributed with the @tomcat.product.name.short@.
</para>
<programlisting language="xml"><![CDATA[<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.eclipse.virgo.web.tomcat.ServerLifecycleLoggingListener"/>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="configuration/keystore"
keystorePass="changeit"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.JAASRealm" appName="virgo-kernel"
userClassNames="org.eclipse.virgo.kernel.authentication.User"
roleClassNames="org.eclipse.virgo.kernel.authentication.Role"/>
<Host name="localhost" appBase="webapps"
unpackWARs="false" autoDeploy="false"
deployOnStartup="false" createDirs="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="serviceability/logs/access"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
<Valve className="org.eclipse.virgo.web.tomcat.ApplicationNameTrackingValve"/>
</Host>
</Engine>
</Service>
</Server>]]></programlisting>
<section id="overview-tomcat-servlet-container">
<title>Description of the Default Apache Tomcat Configuration</title>
<para>
The following bullets describe the main elements and attributes in the default <literal>tomcat-server.xml</literal> file; for details about updating this file to further configure the embedded Apache Tomcat server, see the <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/config/index.html">Apache Tomcat Configuration Reference</ulink>.
</para>
<tip>
<title>Relative paths</title>
<para>If the configured path to a directory or file does not represent an absolute path, @project.name@ typically interprets it as a path relative to the <filename>$SERVER_HOME</filename> directory.</para>
</tip>
<itemizedlist>
<listitem><para>The root element of the <literal>tomcat-server.xml</literal> file is <literal>&lt;Server&gt;</literal>. The attributes of this element represent the characteristics of the entire embedded Tomcat servlet container. The <literal>shutdown</literal> attribute specifies the command string that the shutdown port number receives via a TCP/IP connection in order to shut down the servlet container. The <literal>port</literal> attribute specifies the TCP/IP port number that listens for a shutdown message.</para></listitem>
<listitem><para>The <literal>&lt;Listener&gt;</literal> XML elements specify the list of lifecycle listeners that monitor and manage the embedded Tomcat servlet container. Each listener class is a Java Management Extensions (JMX) MBean that listens to a specific component of the servlet container and has been programmed to do something at certain lifecycle events of the component, such as before starting up, after stopping, and so on.</para>
<para> The first four <literal>&lt;Listener&gt;</literal> elements configure standard Tomcat lifecycle listeners. The listener implemented by the <literal>org.eclipse.virgo.web.tomcat.ServerLifecycleLoggingListener</literal> class is specific to @tomcat.product.name@ and manages server lifecycle logging.
</para> </listitem>
<listitem><para>The <literal>&lt;Service&gt;</literal> XML element groups together one or more connectors and a single engine. Connectors define a transport mechanism, such as HTTP, that clients use to to send and receive messages to and from the associated service. There are many transports that a client can use, which is why a <literal>&lt;Service&gt;</literal> element can have many <literal>&lt;Connector&gt;</literal> elements. The engine then defines how these requests and responses that the connector receives and sends are in turn handled by the servlet container; you can define only a single <literal>&lt;Engine&gt;</literal> element for any given <literal>&lt;Service&gt;</literal> element.</para>
<para> The sample <literal>tomcat-server.xml</literal> file above includes three <literal>&lt;Connector&gt;</literal> elements: one for the HTTP transport, one for the HTTPS transport, and one for the AJP transport. The file also includes a single <literal>&lt;Engine&gt;</literal> element, as required.
</para></listitem>
<listitem><para>The first connector listens for HTTP requests at the <literal>8080</literal> TCP/IP port. The connector, after accepting a connection from a client, waits for a maximum of 20000 milliseconds for a request URI; if it does not receive one from the client by then, the connector times out. If this connector receives a request from the client that requires the SSL transport, the servlet container automatically redirects the request to port <literal>8443</literal>. </para>
</listitem>
<listitem><para>The second connector is for HTTPS requests. The TCP/IP port that users specify as the secure connection port is <literal>8443</literal>. Be sure that you set the value of the <literal>redirectPort</literal> attribute of your non-SSL connectors to this value to ensure that users that require a secure connection are redirected to the secure port, even if they initially start at the non-secure port. The <literal>SSLEnabled</literal> attribute specifies that SSL is enabled for this connector. The <literal>secure</literal> attribute ensures that a call to <literal>request.isSecure()</literal> from the connecting client always returns <literal>true</literal>. The <literal>scheme</literal> attribute ensures that a call to <literal>request.getScheme()</literal> from the connecting client always returns <literal>https</literal> when clients use this connector. </para>
<para>The <literal>maxThreads</literal> attribute specifies that the servlet container creates a maximum of 150 request processing threads,
which determines the maximum number of simultaneous requests that can be handled.
The <literal>clientAuth</literal> attribute specifies that the servlet container does not require a certificate chain
unless the client requests a resource protected by a security constraint that uses CLIENT-CERT authentication.
</para>
<para>The <literal>keystoreFile</literal> attribute specifies the name of the file that contains the servlet container&rsquo;s
private key and public certificate used in the SSL handshake, encryption, and decryption.
You use an alias and password to access this information.
In the example, this file is <literal>$SERVER_HOME/configuration/keystore</literal>.
The <literal>keystorePass</literal> attributes specify the password used to access the keystore.
</para></listitem>
<listitem><para>The third AJP Connector element represents a Connector component that communicates with a web connector via the AJP protocol.
</para></listitem>
<listitem><para>The engine has a logical name of <literal>Catalina</literal>;
this is the name used in all log and error messages so you can easily identify problems.
The value of the <literal>defaultHost</literal> attribute refers to the name of a <literal>&lt;Host&gt;</literal>
child element of <literal>&lt;Engine&gt;</literal>;
this host processes requests directed to host names on this servlet container.
</para>
</listitem>
<listitem> <para>The <literal>&lt;Realm&gt;</literal> child element of <literal>&lt;Engine&gt;</literal> represents a database of
users, passwords, and mapped roles used for authentication in this service. Virgo Web Server uses an implementation of the Tomcat 6 Realm interface that authenticates users through the Java Authentication and Authorization Service (JAAS) framework which is provided as part of the standard J2SE API.</para>
<para>With the JAASRealm, you can combine practically any conceivable security realm with Tomcat's container managed authentication. For details, see <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html">Realm Configuration</ulink>.</para>
</listitem>
<listitem><para>The <literal>&lt;Host&gt;</literal> child element represents a virtual host,
which is an association of a network name for a server (such as <literal>www.mycompany.com</literal>) with the particular
server on which Catalina is running.
The servlet container unpacks Web applications into a directory hierarchy if they are deployed as WAR files.
</para>
<para>
Note that multiple <literal>&lt;Host&gt;</literal> elements are not supported in @tomcat.product.name@.
</para>
</listitem>
<listitem><para>Finally, the <literal>org.apache.catalina.valves.AccessLogValve</literal> valve creates log files
in the same format as those created by standard web servers.
The servlet container creates the log files in the <literal>$SERVER_HOME/serviceability/logs/access</literal> directory.
The log files are prefixed with the string <literal>localhost_access_log.</literal>, have a suffix of <literal>.txt</literal>,
use a standard format for identifying what should be logged, and do not include DNS lookups of the IP address of the remote host.
</para> </listitem>
</itemizedlist>
</section>
<section id="configuring-tomcat-connectors">
<title>Connector Configuration</title>
<para> The @tomcat.product.name@ supports the configuration of any connector supported by Apache Tomcat.
See the default configuration above for syntax examples, and for further details of the configuration properties
supported for various <literal>&lt;Connector&gt;</literal> implementations,
consult the official <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/config/http.html">Tomcat HTTP Connector</ulink> documentation.
</para>
<tip>
<title>Configuring SSL for Tomcat</title>
<para> The @tomcat.product.name@ distribution includes a preconfigured <filename>$SERVER_HOME/configuration/keystore</filename>
file that contains a single self-signed SSL Certificate.
The password for this <filename>keystore</filename> file is <literal>changeit</literal>.
This <filename>keystore</filename> file is intended for testing purposes only.
For detailed instructions on how to configure Tomcat&rsquo;s SSL support,
consult the official <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html">Tomcat SSL Configuration HOW-TO</ulink>.
</para>
</tip>
</section>
<section id="configuring-tomcat-clustering">
<title>Cluster Configuration</title>
<para>
@tomcat.product.name@ supports standard Apache Tomcat cluster configuration.
By default, clustering of the embedded servlet container is disabled,
and the default configuration does not include any clustering information.
See <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html">Tomcat Clustering/Session Replication HOW-TO</ulink>
for detailed information about enabling and configuring clustering.
</para>
</section>
<section id="configuring-default-web-xml">
<title>Default web.xml Configuration</title>
<para>
Java Servlet specification enables web applications to provide deployment descriptor (<literal>web.xml</literal>) in the <literal>WEB-INF</literal> directory.
Apache Tomcat introduces a default <literal>web.xml</literal> which is similar to web application's <literal>web.xml</literal>, but provides configurations that are applied to all web applications.
When deploying a web application, Apache Tomcat uses the default <literal>web.xml</literal> file as a base configuration.
If the web application provides its own configurations via <literal>web.xml</literal> (the one located in the web application's <literal>WEB-INF</literal>) or annotations, they overwrite the default ones.
In @tomcat.product.name@ you can also provide default configurations for all web applications.
If you want to change/extend the default configurations, you can provide the default <literal>web.xml</literal> file located in the <literal>@tomcat.product.name.short@_HOME/configuration</literal> directory.
</para>
<para>
<tip>Be careful when changing/extending the default <literal>web.xml</literal> as this will affect all web applications.</tip>
</para>
<para>
Here's an extract of the default configuration distributed with the @tomcat.product.name.short@.
</para>
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>abs</extension>
<mime-type>audio/x-mpeg</mime-type>
</mime-mapping>
......
<mime-mapping>
<extension>ppt</extension>
<mime-type>application/vnd.ms-powerpoint</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
]]></programlisting>
<para>
The following bullets describe the main elements in the default <literal>web.xml</literal> file.
<itemizedlist>
<listitem>
<para>The <literal>&lt;Servlet&gt;</literal> XML element declares a given servlet and its configurations. The sample <literal>web.xml</literal> file above includes two &lt;Servlet&gt; elements.</para>
<itemizedlist>
<listitem>
<para>
The default servlet serves static resources and processes the requests that are not mapped to any servlet.
For details about default servlet configuration, see the <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/default-servlet.html">Apache Tomcat Default Servlet Reference.</ulink>.
</para>
</listitem>
<listitem>
<para>
The jsp servlet serves the requests to JavaServer Pages. It is mapped to the URL pattern "*.jsp" and "*.jspx".
For details about jsp servlet configuration, see the <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html">Apache Tomcat Jasper 2 JSP Engine.</ulink>.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>The <literal>&lt;servlet-mapping&gt;</literal> XML element specifies the mapping between the servlet and URL pattern.</para>
</listitem>
<listitem>
<para>
The <literal>&lt;session-config&gt;</literal> XML element defines the session configuration for one web application.
The sample <literal>web.xml</literal> file above specifies that the session timeout for all web applications will be 30 minutes by default.
</para>
</listitem>
<listitem>
<para>
The <literal>&lt;mime-mapping&gt;</literal> XML element defines a mapping between a filename extension and a mime type.
When serving static resources, a "Content-Type" header will be generated based on these mappings.
</para>
</listitem>
<listitem>
<para>
The <literal>&lt;welcome-file-list&gt;</literal> XML element specifies a list of welcome files.
When a request URI refers to a directory, the default servlet looks for a "welcome file" within that directory.
If the "welcome file" exists it will be served, otherwise 404 status or directory listing will be returned, depending on the default servlet configuration.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section id="configuring-tomcat-contexts">
<title>Context Configuration</title>
<para>
@tomcat.product.name@ supports standard Apache Tomcat web application context configuration.
The <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/config/index.html">Apache Tomcat Configuration Reference</ulink> has a section on
<ulink url="http://tomcat.apache.org/tomcat-7.0-doc/config/context.html">The Context Container</ulink> which describes the mechanism that
is used in @tomcat.product.name.short@ for searching context configuration files and details the context configuration properties.
</para>
<para>
Context configuration files may be placed in the following locations,
where <literal>[enginename]</literal> is the name of Tomcat's engine ('Catalina' by default) and <literal>[hostname]</literal> names
a virtual host ('localhost' by default), both of which are configured in <literal>tomcat-server.xml</literal>:
<itemizedlist>
<listitem>
<para>
<literal>$SERVER_HOME/configuration/context.xml</literal> provides the default context configuration file for all web applications.
</para>
</listitem>
<listitem>
<para>
The <literal>$SERVER_HOME/configuration/[enginename]/[hostname]</literal> directory may contain:
<itemizedlist>
<listitem>
<para>
The default context configuration for all web applications of a given virtual host in the file <literal>context.xml.default</literal>.
</para>
</listitem>
<listitem>
<para>
Individual web applications' context configuration files as described in the Apache Tomcat Configuration Reference.
For example, the context for a web application with
context path <literal>foo</literal> may be configured in <literal>foo.xml</literal>.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</para>
<para>
Note that the following context configuration features are not supported in @tomcat.product.name@:
<itemizedlist>
<listitem>
<para>
Custom class loaders.
</para>
</listitem>
<listitem>
<para>
Specifying the context path. This is specified using the <literal>Web-ContextPath</literal> header in the web application's
<literal>MANIFEST.MF</literal> file.
</para>
</listitem>
<listitem>
<para>
Specifying the document base directory.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section id="configuring-jsp-compilation">
<title>JSP Compilation</title>
<para>
By default Apache Tomcat compiles JSP files in web applications agains Java 1.6.
In order to enable JSP compilation against Java 1.7 for your web application,
additional init parameters (<literal>compilerSourceVM</literal> and <literal>compilerTargetVM</literal>) should be added for the <literal>org.apache.jasper.servlet.JspServlet</literal> configuration.
For details about <literal>org.apache.jasper.servlet.JspServlet</literal> configuration, see the <ulink url="http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html">Apache Tomcat Jasper 2 JSP Engine</ulink>.
<literal>org.apache.jasper.servlet.JspServlet</literal> configuration can be provided with the web application's web.xml.
</para>
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="ISO-8859-1"?>
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.7</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
]]></programlisting>
</section>
</section>
<section id="configuring-web">
<title>Configuring the Web Integration Layer</title>
<para>
@tomcat.product.name@ integrates an OSGi-enhanced version of the <ulink url="http://tomcat.apache.org/">Tomcat Servlet Container</ulink>
in order to provide support for deploying Java EE WARs and OSGi <emphasis>Web Application Bundles</emphasis>.
</para>
<para>
For @tomcat.product.name@ you
configure the behaviour of the Web Integration Layer using the properties file called <literal>org.eclipse.virgo.web.properties</literal>.
The <literal>org.eclipse.virgo.web.properties</literal> file is located in the <literal>$SERVER_HOME/repository/ext</literal> directory.
</para>
<para>The following table describes the properties. </para>
<table id="configuring-web-integration-layer" colsep="1" frame="all" rowsep="1">
<title>Web Integration Layer Properties</title>
<tgroup cols="3">
<thead>
<row>
<entry>
Property
</entry>
<entry>
Description
</entry>
<entry>
Default Value
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<literal>WABHeaders</literal>
</entry>
<entry>
<para>
Specifies how Web Application Bundle manifest headers are processed.
See "Web Application Manifest Processing" in the
<ulink url="../../virgo-programmer-guide/html/index.html">Programmer Guide</ulink> for details.
</para>
<para>
A value of <literal>strict</literal> causes @tomcat.product.name.short@ to interpret certain headers in strict compliance with
the OSGi Web Applications specification if they are not specified.
</para>
<para>
A value of <literal>defaulted</literal> causes @tomcat.product.name.short@ to set certain headers to default values if they are not specified.
This was how @tomcat.product.name.short@ behaved prior to version 3.
<emphasis>This value is provided as a migration aid and may not be supported in future releases.</emphasis>
A warning event log message (WE0006W) is generated if this value is specified.
</para>
<para>
The @jetty.product.name@ will always operate in <literal>strict</literal> mode.
</para>
<para>
@nanoweb.product.name@ does not have a Web Integration Layer, but has a corresponding kernel property.
See <link linkend="configuring-deployment">Configuring Deployment</link>.
</para>
</entry>
<entry>
<literal>strict</literal>
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
There is no Web Integration Layer in @jetty.product.name@. The relevant configuration is described in
<link linkend="configuring-jetty">Configuring the Embedded Jetty Servlet Container</link>.
</para>
</section>
<section id="configuring-jetty">
<title>Configuring the Embedded Jetty Servlet Container</title>
<para>
@jetty.product.name@ supports <emphasis>Web Application Bundles</emphasis>, but does not provide support for Java EE WARs.
</para>
<para>
The @jetty.product.name@ contains a standard Jetty configuration file at <literal>SERVER_HOME/jetty/etc/jetty.xml</literal>.
This has been tailored to the @umbrella.product.name@. To make modifications please refer to the
<ulink url="http://wiki.eclipse.org/Jetty/Howto/Configure_Jetty#Using_Jetty_XML">Jetty documentation</ulink>.
</para>
</section>
</chapter>