<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xml:id="services.web.config" xml:lang="en"
         xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:mml="http://www.w3.org/1998/Math/MathML"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <title>web service configuration</title>
  </info>

  <para>This service provides containers for the web components used by the
  <xi:include href="../../variables.xml" xpointer="j2ee" />
  applications.</para>

  <para><xi:include href="../../variables.xml" xpointer="appserver" />
  provides two implementations of this service: one for Jetty 6.x, one for
  Tomcat 6.x. It is necessary to run this service in order to use the
  JonasAdmin tool. A web container is created from a <filename
  class="extension">war</filename> file.</para>

  <para>In development mode, as all other <xi:include
  href="../../variables.xml" xpointer="j2ee" /> archives war archives can be
  deployed automatically as soon as they are copied under $JONAS_BASE/deploy
  and undeployed as soon as they has been removed from this location.</para>

  <para>Here is the part of <filename>jonas.properties</filename> concerning
  the <emphasis role="bold">web</emphasis> service:<screen>#
###################### JOnAS Web container service configuration
#
#  Set the name of the implementation class of the web container service.
jonas.service.web.class    org.ow2.jonas.web.tomcat6.Tomcat6Service
#jonas.service.web.class    org.ow2.jonas.web.jetty6.Jetty6Service

#  Set the XML deployment descriptors parsing mode for the WEB container
#  service (with or without validation).
jonas.service.web.parsingwithvalidation    true                          <co
        xml:id="web.parsingwithvalidation" />

#  If true, the onDemand feature is enabled. A proxy is listening on the http port and will make actions like starting or deploying applications.
#  The web container instance is started on another port number (that can be specified) but all access are proxified.
#  It means that the web container will be started only when a connection is done on the http port.
#  The .war file is also loaded upon request.
#  This feature cannot be enabled in production mode.
jonas.service.web.ondemand.enabled    true                               <co
        xml:id="ondemand.enabled" />

#  The redirect port number is used to specify the port number of the http web container.
#  The proxy will listen on the http web container port and redirect all requests on this redirect port
#  0 means that a random port is used.
jonas.service.web.ondemand.redirectPort    0                             <co
        xml:id="ondemand.redirectPort" />
</screen>For customizing the <emphasis role="bold">web </emphasis>service, it
  is possible to:</para>

  <calloutlist>
    <callout arearefs="web.parsingwithvalidation">
      <para>Set or not the XML validation at the deployment descriptor parsing
      time.</para>
    </callout>

    <callout arearefs="ondemand.enabled">
      <para>Enable or not the onDemand feature. In addition of activating this
      global feature, each web application that has to be loaded on demand
      must declare the <emphasis>on-demand</emphasis> element in the JOnAS
      deployment descriptor (<filename>WEB-INF/jonas-web.xml</filename>) as
      below:</para>

      <programlisting>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
&lt;jonas-web-app xmlns="http://www.objectweb.org/jonas/ns"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.objectweb.org/jonas/ns
  http://www.objectweb.org/jonas/ns/jonas-web-app_5_1.xsd"&gt;

  ...
  
  &lt;!-- Load this application on demand (if enabled in the webcontainer service) --&gt;
  &lt;on-demand&gt;true&lt;/on-demand&gt;
&lt;/jonas-web-app&gt;</programlisting>
    </callout>

    <callout arearefs="ondemand.redirectPort">
      <para>This property is specific to the onDemand feature. Useful to set
      the port number of the http web container in case of the port number
      defined in the web server configuration is used by the proxy.</para>
    </callout>
  </calloutlist>
</section>
