<s1 title="Servlet and Host Configuration">

<p>HTTP and Srun configuration is identical except for load balancing
(<var/srun/> and <var/srun-backup/>.)</p>

<p>HTTP configuration follows the Servlet 2.2 deployment descriptors.
The nesting depth is important, but order is generally not important.
In the sections that follow, the section
header tells where the attribute belongs.  For example, the
<var/servlet-mapping/> configuration in
<var/caucho.com/http-server/host/web-app/> looks like:</p>

<example>
&lt;caucho.com>
  &lt;http-server>
    &lt;host id=''>
      &lt;web-app id='/'>
        &lt;servlet-mapping url-pattern='/test' .../>
      &lt;/web-app>
    &lt;/host>
  &lt;/http-server>
&lt;/caucho.com>
</example>

<p>Most of the interesting configuration belongs in
<a href="app-config.xtp">web-app</a>.  For example, <var/servlet-mapping/>
belongs in a <var/web-app/> element, but
<var/thread-max/> belongs in the top-level <var/http-server/> element.</p>

<p>The server contains a number of <var/host/> elements and each
<var/host/> contains <var/web-app/> elements.  Each <var/host/>
configures a virtual host and each <var/web-app/> configures an
application.
</p>

<example title='Full Configuration'>
&lt;caucho.com>
&lt;http-server>
  &lt;host id='gryffindor.caucho.com' app-dir='gryffindor'>
    &lt;web-app id='/'>
      &lt;servlet-mapping .../>
      ...
    &lt;/web-app>
    
    &lt;web-app id='/test' app-dir='/usr/local/test'>
      ...
    &lt;/web-app>
  &lt;/host>
  
  &lt;host id='slytherin.caucho.com' app-dir='slytherin'>
    ...
  &lt;/host>

  ...
&lt;/http-server>
&lt;/caucho.com>
</example>

<objsummary/>

<s2 title='http-server'>

<defun name='http-server' title='http-server'>

<p>Configuration for the servlet engine.</p>

<p>Any &lt;resource-ref> resource configured in &lt;http-server> is
shared for all virtual hosts and web-apps in the server.  So a database
or EJB server configured in the &lt;http-server> will be shared
for all virtual hosts.</p>

<p>Default application tags like
&lt;servlet-mapping> may appear in the &lt;http-server> section.  These
tags will be defaults for the contained &lt;web-app> and &lt;host>.

</defun>

<defun title='alternate-session-url-prefix' version="Resin 2.0.5">
<p>Configures an alternate URL prefix to be used for /~J=xxx/test.jsp
style url-rewriting.  There is no default.</p>

<p>If alternate-session-url-prefix is configured, URL rewriting will
add the session to the beginning of the URL as a path prefix instead of the
standard ;jsessionid= suffix.  For clients like mobile devices with limited
memory, this will allow careful web designers to minimize the page size.
</p>

<example>
...
&lt;http-server>
  &lt;alternate-session-url-prefix>/~J=&lt;/alternate-session-url-prefix>
  ...
</example>

</defun>

<defun title='cache' version='Resin 1.1'>
<p>Activates the memory cache with a specified size.  Resin's
cache acts as a proxy cache.  Pages with <var/expires/> headers will
be cached, avoiding expensive Java or Database processing.</p>

<p>To activate caching, you must add a cache directive.  By default,
caching is disabled.</p>

<p>The cache combines memory and file caching.  The most referenced
pages are served out of memory and the rest are served from the
filesystem.</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>dir<td>File directory to store the cached pages<td>resin1.2/cache
<tr><td>entries<td>Number of entries allowed in the memory cache<td>16386
<tr><td>size<td>Size in kilobytes of the memory<td>1024
<tr><td>enable<td>true or false to disable<td>true
</deftable>

<p>For example, a page created by several sophisticated and slow
database queries may only change every 15 minutes.  If that page sets
its expires header, Resin can serve the generated page as fast as a
static page.</p>

<p><b>Default:</b> by default, cache is disabled.</p>

</defun>

<defun title='error-log'>
<p>Specifies the file for error logging.  The log is relative
to $RESIN_HOME.  You can use the special path <var/$app-dir/> to make
the log relative to the host, e.g. <var/$app-dir/WEB-INF/log/access.log/>.
</p>

<example>
&lt;caucho.com&gt;
&lt;http-server error-log='log/error.log'&gt;

&lt;host id='foo.com' error-log='log/foo.log'&gt;
 ...
&lt;/host&gt;

&lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

<deftable title="error-log attributes">
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>encoding<td>character encoding<td>The JVM's default
<tr><td>href<td>The log's filename<td>required
<tr><td>rollover-period<td>How often the log should be rotated<td>never
<tr><td>rollover-size<td>How large the log can be before rotating<td>infinite
<tr><td>timestamp<td>Format for a timestamp before each entry<td>none
</deftable>

<p><b>Default:</b> By default, a host's error log will use an
error-log defined in http-server.</p>
</defun>

<defun name=error-page title='error-page' index='error-page'>
<p>The url to display if the web server can't connect to Resin.
This is a special case of <a href='app-config.xtp#error-page'>error-page</a>
in the web-app configuration.</p>

<p>The Apache and IIS plugins use this special error-page directive to
display a custom error page when the web server can't connect to Resin.
The location must be an absolute path understandable to the web server.
</p>

<example>
&lt;caucho.com&gt;
  &lt;http-server&gt;
    &lt;error-page exception-type='connection'
                location='/connection_error.html'/&lt;>
  &lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

</defun>

<defun title='forbid-host' version='Resin 2.0.3'>
<p>Selects a list of IPs that are forbidden.</p>

<example>
&lt;http-server>
  &lt;forbid-host>192.168.0.1&lt;/forbid-host>
  &lt;forbid-host>192.168.0.2&lt;/forbid-host>
  ...
&lt;/http-server>
</example>

<p>forbid-host is implemented by com.caucho.http.security.ForbidHost.  It is
stored in JNDI as java:comp/env/caucho/forbid-host.  An intelligent
log might detect a denial of service attack and dynamically forbid the host.
</p>
</defun>

<defun name=ignore title='ignore-client-disconnect' version='Resin 1.2.3'>
<p>Ignores ClientDisconnectionExceptions thrown when the browser
disconnects.</p>

<example>
&lt;caucho.com&gt;
  &lt;http-server&gt;
    &lt;ignore-client-disconnect>false&lt;/ignore-client-disconnect>

    ...
  &lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

<p>False by default, throws exceptions on disconnects.</p>
</defun>

<defun title='global-system-properties' version="Resin 2.0.5">
<p>Determines if system-properties are classloader specific or global.</p>

<p>By default, Resin's web-apps and hosts have isolated system properties.
So System.getProperty("test") in host foo.com might return a different value
from System.getProperty("test") in host bar.com.  Usually, this is the
correct solution to prevents hosts and web-apps from affecting each other.
Specialized applications may want to disable this feature however.</p>

<example>
...
&lt;http-server>
  &lt;global-system-properties>true&lt;/global-system-properties>
  ...
&lt;/http-server>
</example>

<p><b>Default:</b> The default value is false.</p>
</defun>

<defun title='host'>
<p>Defines a virtual host.  If no hosts are specified, or if a
request doesn't match a host, configuration in http-server will be
used instead.</p>

<p>The id may contain a list of hosts.  Any host in the list will
match.</p>

<p>See <a href='app-config.xtp'>application configuration</a> for
servlet configuration.</p>

<p>Hosts can use <var/regexp/> instead of <var/id/> to dynamically create
new hosts.</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>id<td>The host name<td>required
<tr><td>regexp<td>A regular expression matching hosts.<td>none
<tr><td>app-dir<td>The root directory of the host (can use replacement vars)
<td>use http-server app-dir
</deftable>

<p>Any &lt;resource-ref> resource configured in &lt;http-server> is
shared for all virtual hosts and web-apps in the server.  So a database
or EJB server configured in the &lt;http-server> will be shared
for all virtual hosts.</p>

<p>Default application tags like
&lt;servlet-mapping> may appear in the &lt;http-server> section.  These
tags will be defaults for the contained &lt;web-app> and &lt;host>.

<example>
&lt;caucho.com&gt;
&lt;http-server&gt;

&lt;host id='www.foobar.com, foobar.com'
      app-dir='foobar/docs'&gt;
  &lt;web-app id='/'>
    &lt;servlet-mapping url-pattern='/servlets/*'
                     servlet-name='invoker'/&gt; 
  &lt;/web-app>
&lt;/host&gt;

&lt;host regexp='([^.]*).users.com'
      app-dir='/home/$1/public_html'&gt;
  ...
&lt;/host&gt;


&lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

<note>Only the Resin Java process understands regexps.  Because mod_caucho,
isapi_srun and the other web server plugins don't understand the regexps,
you may need to do additional work to make the web server send the request
to Resin.</note>

<p><b>Default:</b> If the <var/id/> attribute is null or '*', the &lt;host>
will be used as the default configuration for any virtual host that doesn't
match a specific &lt;host> block.</p>

</defun>

<defun title='http' version="Resin 1.2">
<p>Defines a HTTP or SSL port for the standalone server.</p>

<deftable>
<tr><th>Attribute<th>Meaning
<tr><td>id<td>http identifier name
<tr><td>host<td>The listening host
<tr><td>port<td>The listening port
<tr><td>virtual-host<td>Virtual host to select a <a href="#host">host</a> block.
<tr><td>ssl<td>enable ssl
<tr><td>key-store-type<td>JSSE Type of the key store (default jks)
<tr><td>key-store-file<td>JSSE File containing the certificates
<tr><td>key-store-password<td>JSSE Password to read the certificates
<tr><td>key-manager-factory<td>JSSE key manager factory type
<tr><td>ssl-context<td>JSSE ssl context type
<tr><td>certificate-file<td>OpenSSL certificate (Resin 2.0.5)
<tr><td>certificate-key-file<td>OpenSSL key certificate (Resin 2.0.5)
<tr><td>certificate-key-password<td>OpenSSL key password (Resin 2.1.1)
<tr><td>crypto-device<td>OpenSSL engine (Resin 2.0.5)

<tr><td>thread-max<td>Maximum number of live threads.<td>200
<tr><td>thread-min<td>Minimum number of live threads.<td>5
<tr><td>thread-keepalive<td>Number of keepalive threads<td>100
<tr><td>request-timeout<td>Max time for a request, after this the request
will be interrupted.<td>30 sec
<tr><td>listen<td>Value of the socket listen parameter<td>5
<tr><td>accept-buffer-size<td>Number of sockets in the accept buffer.<td>256
<tr><td>shutdown-wait-time<td>How long to wait for connections to
finish before exiting.<td>10 sec.
</deftable>

<example title='Basic HTTP configuration'>
&lt;caucho.com&gt;
  &lt;http-server&gt;
    &lt;http port='8080'&gt;
    ...
  &lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

<example title='JSSE configuration'>
&lt;caucho.com&gt;
  &lt;http-server&gt;
    &lt;http port='8443'&gt;
      &lt;ssl>true&lt;/ssl>
      &lt;key-store-type>pkcs12&lt;/key-store-type>
      &lt;key-store-file>keys/server.p12&lt;/key-store-file>
      &lt;key-store-password>changeit&lt;/key-store-password>
    &lt;/http>
    ...
  &lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

</defun>

<defun name=ping title='ping' index='ping'>
<p>Specifies a list of URLs to test to check the webserver's uptime.
Ping adds reliability to a web site.  It launches a separate thread to
check if a list of URLs return valid results, i.e. HTTP status 200.  If the
URLs fail after repeated attempts, Resin will exit.  The parent process,
either wrapper.pl or the NT service, will automatically restart Resin.
</p>

<p>Because the ping thread is in the same JVM as the web server,
ping cannot detect all failure types.  In particular, if the JDK itself
freezes, ping can do nothing.  It can detect problems like deadlocks
or database connection overflows or memory leaks.
</p>

<p>The URLs listed in the &lt;ping> should exercise the important operations
in the application.  For example, it should at least access the database.
</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>url<td>URL to test for failure<td>required
<tr><td>sleep-time<td>time to sleep between pings.<td>15 min
<tr><td>retry-count<td>how many times to retry failures before restarting.<td>3
<tr><td>retry-time<td>how long to sleep between failures.<td>1 sec
<tr><td>class-name<td>specify a custom ping class (Resin 2.0.3)<td>com.caucho.http.admin.PingThread 
<tr><td>socket-timeout<td>how long the socket should wait for a response before timing out.<td>10s
</deftable>

<example>
&lt;caucho.com>
&lt;http-server>
  &lt;ping>
    &lt;sleep-time>1m&lt;/sleep-time>
    &lt;retry-count>3&lt;/retry-count>
    &lt;retry-time>1s&lt;/retry-time>
    &lt;url>http://localhost:8080/test.jsp&lt;/url>
  &lt;/ping>

  ...
&lt;/http-server>
&lt;/caucho.com>
</example>

<p>Custom ping classes must extend com.caucho.http.admin.PingThread.
For example, the PingMailer will mail when the PingThread fails.
</p>

<deftable title='PingMailer additional Attributes'>
<tr><td>Attribute<th>Meaning<th>Default
<tr><td>mail-to<td>Recipient of the warning mail<td>required
<tr><td>mail-from<td>Sender of the mail<td>the user of the Resin process
<tr><td>mail-subject<td>The subject of the mail<td>"Resin ping has failed"
</deftable>

<example>
&lt;ping>
  &lt;class-name>com.caucho.http.admin.PingMailer&lt;/class-name>
  &lt;sleep-time>1m&lt;/sleep-time>
  &lt;retry-count>3&lt;/retry-count>
  &lt;retry-time>1s&lt;/retry-time>
  &lt;url>http://localhost:8080/test.jsp&lt;/url>

  &lt;mail-to>webmaster@localhost&lt;/mail-to>
&lt;/ping>
</example>

<p>No default.</p>
</defun>

<defun title='srun' version='Resin 1.1'>
<p>Defines multiple client machines for load balancing.  This
directive used by the web server (Apache or IIS) and by the Java portion
of Resin.</p>

<p>Each <var/srun/> directive adds a new client to receive load
balanced requests.  With Resin 1.2, the resin.conf must have at least
one &lt;srun> or &lt;http> element.</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>id<td>srun identifier name.<td>none
<tr><td>host<td>The host name of the client srun.<td>all interfaces
<tr><td>port<td>The port name of the client srun.<td>none
<tr><td>connect-timeout<td>How long to wait for a connection from the
web server to the Resin srun before giving up.<td>30 sec
<tr><td>live-time<td>How long the web-server/srun connection should stay live.<td>10 sec
<tr><td>dead-time<td>How long before checking that a srun has come back up.<td>5 sec
<tr><td>timeout<td>How long the load balancing server should wait for a response.<td>30 sec

<tr><td>thread-max<td>Maximum number of live threads.<td>200
<tr><td>thread-min<td>Minimum number of live threads.<td>5
<tr><td>thread-keepalive<td>Number of keepalive threads<td>100
<tr><td>request-timeout<td>Max time for a request, after this the request
will be interrupted.<td>30 sec
<tr><td>listen<td>Value of the socket listen parameter<td>5
<tr><td>accept-buffer-size<td>Number of sockets in the accept buffer.<td>256
<tr><td>shutdown-wait-time<td>How long to wait for connections to
finish before exiting.<td>10 sec.
</deftable>

<example title='Load balance over three machines'>
&lt;caucho.com&gt;
  &lt;http-server&gt;
    &lt;srun id='a' host='host1.caucho.com' port='6802'&gt;
    &lt;srun id='b' host='host2.caucho.com' port='6802'&gt;
    &lt;srun id='c' host='host2.caucho.com' port='6803'&gt;
  &lt;/http-server&gt;
&lt;/caucho.com&gt;
</example>

<p>To start srun 'a' use a command line like</p>
<example>
unix> <var/srun.sh -server a/>
Resin 2.1.0
srun listening to host1.caucho.com:6802
</example>

<p>On Unix, when starting a daemon, you'll need to specify a unique pid file.
</p>

<example>
unix> <var/srun.sh -server a -pid a.pid start/>
</example>
</defun>

<defun title='srun-backup' version='Resin 1.1'>
<p>Defines backup client machines for load balancing.  This
directive is only picked up by the load balancer.  The
Java portion of Resin treats a &lt;srun-backup> like any other srun.
Normally, &lt;srun-backup> is only used when each web server has
a primary &lt;srun> in preference to other &lt;srun> JVMs.
See the <a href="balance.xtp">load-balancing</a> section
for more information.
</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>id<td>srun identifier name<td>none
<tr><td>host<td>The host name of the client srun<td>all interfaces
<tr><td>port<td>The port name of the client srun<td>none
<tr><td>connect-timeout<td>How long to wait for a connection from the
web server to the Resin srun before giving up.<td>30 sec
<tr><td>live-time<td>How long a keepalive connection will remain alive before
closing.<td>5 sec.
<tr><td>dead-time<td>How long to treat a non-responding srun before trying again.<td>5 sec.
<tr><td>shutdown-wait-time<td>How long to wait for connections to
finish before exiting.<td>10 sec.
</deftable>
</defun>

<defun title='thread-keepalive'>
<p>Number of threads to be used in keepalive requests.  When
Resin is used in combination with a web server, like Apache or IIS,
Resin will reuse the socket connection to that web server if
possible.  <var/thread-keepalive/> specifies the number of theads that
can be used in these keepalive connections.
</p>

<p>Defaults to 100.</p>
</defun>

<defun title='thread-max'>
<p>Maximum number of request-handling threads.</p>

<p>Defaults to 200.</p>
</defun>

</s2>

<!--
   - host section
  -->

<s2 title='host'>

<defun title='access-log'>
<p>Specifies the access log file.  The log is relative to
$RESIN_HOME.  You can use the special path <var/$app-dir/> to make
the log relative to the host, e.g. <var/$app-dir/WEB-INF/log/access.log/>.
</p>

<deftable>
<tr><th>Attribute<th>Description<th>Default
<tr><td>id<td>The access log path.<td>required
<tr><td>format<td>Access log format.<td>see below
<tr><td>class-name<td>Class implementing AbstractAccessLog for custom logging.
<tr><td>rollover-period<td>how often to rollover the log.
Normally in days (15D), weeks (2W) or months (1M).<td>none
<tr><td>rollover-size<td>max size of the log before a rollover.<td>10 meg
<tr><td>archive-format<td>format the name of the archive file.<td>n/a
</deftable>

<p>The <var/rollover-period/> variable controls how often the access log
will be rotated.  When the time runs out, Resin will move the old log
file to a timestamped one, e.g. access.log20001114.  Rollovers happen
at midnight in the local time if the time period is a day or longer.
</p>

<p>The access log formatting variables follow the Apache variables:</p>

<deftable>
<tr><td>%b<td>result content length
<tr><td>%h<td>remote IP addr
<tr><td>%{<var/xxx/>}i<td>request header <var/xxx/>
<tr><td>%{<var/xxx/>}o<td>response header <var/xxx/>
<tr><td>%{<var/xxx/>}c<td>cookie value <var/xxx/>
<tr><td>%n<td>request attribute
<tr><td>%r<td>request URL
<tr><td>%s<td>status code
<tr><td>%{<var/xxx/>}t<td>request date with optional time format string.
<tr><td>%T<td>time of request in seconds
<tr><td>%u<td>remote user
<tr><td>%U<td>request URI
</deftable>

<p>The default format is:</p>

<def>
"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
</def>

<example>
&lt;host id=''>

  &lt;access-log id='log/access.log'&gt;
    &lt;rollover-period>2W&lt;/rollover-period>
  &lt;/access-log>

 ...

&lt;/host&gt;
</example>

<p>If the web-app doesn't specify an access-log, it will use the host's
access-log.</p>
</defun>

<defun title='doc-dir' version="Resin 2.1">
<p>Specifies the document directory for the &lt;host>
or &lt;http-server>.</p>

<p>&lt;doc-dir> values may use use system properties,
like <var/$server.root/> or <var/$resin.home/> or even <var/$foo/>.</p>

<example>
&lt;host id=''&gt;
  &lt;doc-dir>/opt/web/default_host&lt;/doc-dir>

 ...

&lt;/host&gt;
</example>

<p><b>Default:</b> Defaults to &lt;root-dir> if specified.  Otherwise
&lt;host> defaults to the document directory of the &lt;http-server>
&lt;http-server> defaults to the server-root.</p>
</defun>

<defun title='root-dir' version="Resin 2.1">
<p>Specifies the root directory for the &lt;host>
or &lt;http-server>.  Non-document data like log files
and war directories are based off the root directory.</p>

<p>&lt;root-dir> values may use use system properties,
like <var/$server.root/> or <var/$resin.home/> or even <var/$foo/>.</p>

<example>
&lt;host id=''&gt;
  &lt;root-dir>/opt/web/default_host&lt;/root-dir>
  &lt;doc-dir>doc&lt;/doc-dir>

 ...

&lt;/host&gt;
</example>

<p><b>Default:</b> Hosts defaults to the &lt;root-dir> of
the &lt;http-server>.  &lt;http-server> defaults to the server-root.
</p>
</defun>

<defun title=session-cookie version="Resin 2.1.2">
<p>Configures session cookie.  The default is "JSESSIONID".</p>
</defun>

<defun title=session-url-prefix version="Resin 2.0">
<p>Configures the URL prefix to be used for url-rewriting.  The
default is ";jsessionid=".</p>
</defun>

<defun title='server-name' version='Resin 2.0.4'>
<p>Defines the canonical url for the host. In some cases, the
specific URL that's used for a virtual host might be different from the &lt;host id='...'> name.  &lt;server-name> lets you specify the exact URL to be added when using a sendRedirect.
</p>

<example>
...
&lt;host id='foo.com'>
  &lt;server-name>http://foo.com&lt;/server-name>
  ...
&lt;/host>
...
</example>
</defun>

<defun title=server-listener version="Resin 2.0.3">
<p>Specifies the classname for a listener when the server starts and
shuts down.  The class must be in the system classpath because
it's called before the dynamic classpaths have been created and after
they've been destroyed.</p>

<p>The server listener class must extend
com.caucho.http.admin.AbstractServerListener.</p>

<example>
&lt;http-server>
  &lt;server-listener>
    &lt;class-name>test.MyListener&lt;/class-name>
  &lt;/server-listener>
  ...
</example>
</defun>

<defun title=servlet-classloader-hack version="Resin 2.0.3">
<p>Enables the Servlet specification classloader hack.
The Servlet 2.3 classloader order violates the JDK
classloader specification.  By default, therefore, Resin follows the
JDK requirements.  Those application which need to violate the JDK spec
may enable the servlet-classloader-hack.</p>

<p>By default, the hack is disabled.</p>
</defun>

<defun title=sticky-sessions version="Resin 2.0">
<p>Enables or disables sticky-session load balancing.</p>

<p>The default is true to enable sticky sessions.</p>
</defun>

<defun title='url-character-encoding'>
<p>Defines the character encoding to be used for decoding the
URL.  Because the HTTP protocol does not specify the encoding to
be used, the server must specify the encoding beforehand.</p>

<p><b>Default: </b> utf-8</p>
</defun>

<defun title='url-length-max'>
<p>Specifies the maximum length allowed in a HTTP URL.  Requests with
longer lengths will receive an error.</p>

<p><b>Default: </b> 8192</p>
</defun>

<defun title='war-dir'>
<p>Specifies a special directory to place war files.  Any .war
(web-application resource) file placed in the war directory will be
automatically expanded and installed.  The .war file will be expanded
into <var/war-expand-dir/>, if specified.</p>

<p>The war-dir is relative to $RESIN_HOME, not to the virtual host's
app-dir.</p>

<example>
&lt;host id='www.foo.com'>
  &lt;war-dir>foo-apps&lt;/war-dir>
&lt;/host>
</example>

<p>Given the above example, if you put foo.war in resin1.2/foo-apps, Resin
will automatically expand it and install it with the prefix <var//foo/>.
So browsing <var/http://localhost:8080/foo/> will give the top-level contents.
</p>

<p>Generally, war files use <var/WEB-INF/web.xml/> for configuration.  The
syntax is the same as for other application configuration.</p>

<p>No war-dir is defined by default.</p>
</defun>

<defun title='war-expand-dir' version='Resin 1.2.3'>
<p>Specifies the destination of war expansion.  Any .war
(web-application resource) file placed in the war-dir directory will be
automatically expanded into war-expand-dir.  You can also create a web-app
by creating a directory in war-expand-dir.</p>

<p>The war-dir is relative to $RESIN_HOME, not to the virtual host's
app-dir.</p>

<p>The special directory <var/ROOT/> lets you define the root web-app.</p>

<p>Generally, war files use <var/WEB-INF/web.xml/> for configuration.  The
syntax is the same as for other application configuration.
</p>

<p><b>Default:</b> Defaults to the value of &lt;war-dir>.
</p>
</defun>

<defun title='web-app'>
<p>Specifies an application.  Applications are self-contained
subtrees of the web site.  They have distinct Application objects,
sessions, and servlet mappings.  Applications can even be deployed
entirely from .jar files.</p>

<p>The full <a href='app-config.xtp'>application configuration</a> is
described in a separate page.</p>

<p>Applications have a root <var/app-dir/> similar to the document root.
By default, it's just the same as the relative path.</p>

<p>Beneath the <var/app-dir/> root, a special directory <var/WEB-INF/>
contains servlet classes and beans.  <var/WEB-INF/classes/> contains Java
source files and Java classes. <var/WEB-INF/lib/> contains additional
jar files for the application.</p>

<deftable>
<tr><th>Attribute<th>Meaning<th>Default
<tr><td>id<td>The url prefix of the application.<td>required
<tr><td>url-regexp<td>A regular expression matching a url prefix.<td>none
<tr><td>app-dir<td>The application's root directory.<td>The subdirectory of
the host's app-dir named by <var/id/>
</deftable>

<example>
&lt;host id='foo.com'&gt;

&lt;web-app id='example/tictactoe'
         app-dir='c:\work\ttt'&gt;
  &lt;servlet-mapping url-pattern='*.foo'
                      servlet-name='com.caucho.jsp.XtpServlet'/&gt;
&lt;/web-app&gt;

&lt;/host&gt;
</example>

<p>The <var/url-regexp/> configuration allows for dynamic applications,
for example, creating a new application for each user.</p>

<example title="Per-user Servlet Directory">
&lt;host&gt;

&lt;web-app url-regexp='^/~([^/]+)'
         app-dir='/home/$1/public_html'&gt;
  ...
&lt;/web-app&gt;

&lt;/host&gt;
</example>

<p>In the above example, users will put their own web.xml
in <var//home/user/public_html/WEB-INF/web.xml/>.  Classes belong
in <var/public_html/WEB-INF/classes/>.</p>

<note>Only the Resin Java process understands regexps.  Because mod_caucho,
isapi_srun and the other web server plugins don't understand the regexps,
you may need to do additional work to make the web server send the request
to Resin.</note>
</defun>

</s2>

<s2 title='Formal Description'>

<def>
http-server ::= <a href="#http">http</a>,
                <a href="#srun">srun</a>,
                <a href="#srun-backup">srun-backup</a>,
                <a href="#thread-max">thread-max</a>,
                <a href="#thread-min">thread-min</a>,
                <a href="#thread-keepalive">thread-keepalive</a>,
                <a href="#request-timeout">request-timeout</a>,
                <a href="#ping">ping</a>,
                <a href="#alternate-session-url-prefix">alternate-session-url-prefix</a>,
                <a href="#session-url-prefix">session-url-prefix</a>,
                <a href="#sticky-sessions">sticky-sessions</a>,
                <a href="#ignore-client-disconnect">ignore-client-disconnect</a>,
                <a href="#global-system-properties">global-system-properties</a>,
                <a href="#root-dir">root-dir</a>,
                <a href="#doc-dir">doc-dir</a>,
                <a href="#cache">cache</a>,
                <a href="#host">host</a>*,
                <var/default host or web-app tags/>*

</def>

</s2>
</s1>
