<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">



<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!-- =============================================================== -->
<!-- $Id: demo.xml,v 1.171 2005/12/16 02:47:11 gregwilkins Exp $ -->
<Configure class="org.mortbay.jetty.Server">


  <!-- =============================================================== -->
  <!-- Configure Logging                                               -->
  <!-- =============================================================== -->

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Assume Commons logging is using Jetty log.  If not this section -->
  <!-- needs to be removed                                             -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

  <!-- Create a jetty commons logger logger for the demo web app-->
  <!-- and map Context logger by display name to demo logger -->  
  <!--
  <New id="demologger" class="org.mortbay.log.LogImpl">        
   <Call name="add">
     <Arg>
       <New class="org.mortbay.log.OutputStreamLogSink">
	 <Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.demo.log</Set>
	 <Set name="retainDays">90</Set>
	 <Set name="append">true</Set>
	 <Set name="logLabels">true</Set>
	 <Set name="logStackSize">true</Set>
	 <Set name="logStackTrace">false</Set>
	 <Set name="logOneLine">false</Set>
	 <Set name="suppressStack">false</Set>
	 <Set name="logTimeZone">GMT</Set>
       </New>
     </Arg>
   </Call>
  </New>
  <Call class="org.mortbay.log.LogFactory" name="getFactory">
    <Call name="setAttribute">
      <Arg>org.mortbay.webapps.*</Arg>
      <Arg ref="demologger"/>
    </Call>  
    <Call name="setAttribute">
      <Arg>org.mortbay.jetty.context.Jetty Demo</Arg>
      <Arg ref="demologger"/>
    </Call>
  </Call>
  -->  
  
  <!-- reconfigure the default logger to log to a file -->  
  <!--
  <Call class="org.mortbay.log.LogFactory" name="getFactory">
    <Call name="getInstance">
      <Arg/>
      <Call name="reset"/>
      <Call name="add">
        <Arg>
          <New class="org.mortbay.log.OutputStreamLogSink">
            <Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.jetty.log</Set>
            <Set name="retainDays">90</Set>
            <Set name="append">true</Set>
            <Set name="logLabels">true</Set>
            <Set name="logStackSize">true</Set>
            <Set name="logStackTrace">false</Set>
            <Set name="logOneLine">false</Set>
            <Set name="suppressStack">false</Set>
            <Set name="logTimeZone">GMT</Set>
          </New>
        </Arg>
      </Call>
    </Call>
  </Call>
  -->
  
  <!-- Uncomment to capture stderr and stdout to commons logging
  <Set class="org.mortbay.log.LogStream" name="logStdErr">true</Set>
  <Set class="org.mortbay.log.LogStream" name="logStdOut">false</Set>
  -->

  <!-- =============================================================== -->
  <!-- Configure the Request Listeners                                 -->
  <!-- =============================================================== -->


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add and configure a HTTP listener to port 8080                       -->
  <!-- The default port can be changed using: java -Djetty.port=80     -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.SocketListener">
        <Set name="Port"><SystemProperty name="jetty.port" default="8080"/></Set>
        <Set name="MinThreads">5</Set>
        <Set name="MaxThreads">100</Set>
        <Set name="MaxIdleTimeMs">30000</Set>
        <Set name="LowResourcePersistTimeMs">5000</Set>
        <Set name="PoolName">Listener</Set>
        <Set name="ConfidentialPort">8443</Set>
        <Set name="IntegralPort">8443</Set>
      </New>
    </Arg>
  </Call>


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add and configure a NIO HTTP listener to port 8888              -->
  <!-- The default port can be changed using: java -Djetty.port=80     -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- UNCOMMENT TO ACTIVATE
  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.nio.SocketChannelListener">
        <Set name="Port">8888</Set>
        <Set name="MinThreads">4</Set>
        <Set name="MaxThreads">10</Set>
        <Set name="SslPort">8443</Set>
      </New>
    </Arg>
  </Call>
  -->

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add a HTTPS SSL listener on port 8443                           --> 
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->  
  <!-- The default provider is used by this listener.  To specify a    -->
  <!-- specific provider, the keystoreType and keystoreProvideName     -->
  <!-- fields may be set.  For example to use the bouncycastle.org     -->
  <!-- provider with a PKCS12 keystore add the following to the        -->
  <!-- listener configuration:                                         -->
  <!--  <Set name="KeystoreType"> PKCS12</Set>                         -->
  <!--  <Set name="KeystoreProviderName">BC</Set>                      -->
  <!-- you can also load provider if it's not installed:               -->
  <!--  <Set name="KeystoreProviderClass">                             -->
  <!--    org.bouncycastle.jce.provider.BouncyCastleProvider           -->
  <!--  </Set>                                                         -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- UNCOMMENT TO ACTIVATE
  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.SunJsseListener">
        <Set name="Port">8443</Set>
        <Set name="MinThreads">5</Set>
        <Set name="MaxThreads">100</Set>
        <Set name="MaxIdleTimeMs">30000</Set>
        <Set name="LowResourcePersistTimeMs">2000</Set>
        <Set name="Keystore"><SystemProperty name="jetty.home" default="."/>/etc/demokeystore</Set>
        <Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
    	<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
        <Set name="PoolName">Listener</Set>

        <Set name="HttpHandler">
          <New class="org.mortbay.http.handler.MsieSslHandler">
	    <Set name="UserAgentSubString">MSIE 5</Set>
	  </New>
        </Set>
      </New>
    </Arg>
  </Call>
  -->


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add a AJP13 listener on port 8009                               -->
  <!-- This protocol can be used with mod_jk in apache, IIS etc.       -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--
  -->
  <Call name="addListener">
    <Arg>
      <New class="org.mortbay.http.ajp.AJP13Listener">
        <Set name="Port"><SystemProperty name="jetty.ajp.port" default="8009"/></Set>
        <Set name="MinThreads">5</Set>
        <Set name="MaxThreads">20</Set>
        <Set name="MaxIdleTimeMs">0</Set>
        <Set name="confidentialPort">443</Set>
        <Set name="PoolName">Listener</Set>
      </New>
    </Arg>
  </Call>


  <!-- =============================================================== -->
  <!-- Set the default web application configuration mechanisms:       -->
  <!--   XMLConfiguration       - handles WEB-INF/web.xml              -->
  <!--   JettyWebConfiguration  - handles WEB-INF/jetty-web.xml        -->
  <!--   jsr77.Configuration    - Adds jsr77 statistics to servlets    -->
  <!--                                                                 -->
  <!-- Order of these classes is significant. The defaults set here    -->
  <!-- can be overridden by calling setConfigurationClassNames() on    -->
  <!-- the webapp context.                                             -->
  <!-- The jsr77 configuration requires additional jars on the         -->
  <!-- on the classpath (use -DSTART=extra/etc/start-jsr77.config) and -->
  <!-- it needs jmx enabled (see README.TXT for instructions).         -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Set name="WebApplicationConfigurationClassNames">
    <Array type="java.lang.String">
      <Item>org.mortbay.jetty.servlet.XMLConfiguration</Item>
      <Item>org.mortbay.jetty.servlet.JettyWebConfiguration</Item>
      <!--
      <Item>org.mortbay.jetty.servlet.jsr77.Configuration</Item>
      -->
    </Array>
  </Set>


  <!-- =============================================================== -->
  <!-- Configure the Contexts                                          -->
  <!-- =============================================================== -->


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add root context web applications.                              -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
    <Arg>/</Arg>
    <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/root</Arg>
    <Set name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>
  </Call>



  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add jetty demo web applications.                                -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
    <Arg>/jetty/*</Arg>
    <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/jetty</Arg>
    <Set name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>

    <!-- See demo/webapps/jetty/WEB-INF/jetty-web.xml for more configuration       -->
    <!-- That configuration could go here, but is more flexible in a separate file -->
  </Call>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add jakarta examples web applications.                          -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
    <Arg>/servlets-examples/*</Arg>
    <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/servlets-examples.war</Arg>
    <Set name="extractWAR">false</Set>
    <Call name="getServletHandler">
      <Call name="getSessionManager">
        <Call name="setUseRequestedId">
          <Arg type="boolean">true</Arg>
        </Call>
      </Call>
    </Call>
  </Call>

  <Call name="addWebApplication">
    <Arg>/jsp-examples/*</Arg>
    <Arg><SystemProperty name="jetty.home" default="."/>/demo/webapps/jsp-examples.war</Arg>
    <Set name="extractWAR">true</Set>
  </Call>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add javadoc                                                     -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addWebApplication">
    <Arg>/javadoc/*</Arg>
    <Arg><SystemProperty name="jetty.home" default="."/>/webapps/javadoc.war</Arg>
    <Set name="extractWAR">false</Set>
  </Call>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Add tomcat examples in naming context                           -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- NamingWebAppContext in JettyExtra package
  <Call name="addContext">
    <Arg><New class="org.mortbay.jetty.servlet.NamingWebAppContext">
           <Set name="contextPath">/naming</Set>
             <Set name="WAR"><SystemProperty name="jetty.home" default="."/>/demo/webapps/examples</Set>
    </New></Arg>
  </Call>
  -->

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Build a demo context manually.                                  -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addContext">
    <Arg>/demo/*</Arg>

    <!-- Uncomment for Context specific request log
    <Set name="RequestLog">
      <New class="org.mortbay.http.NCSARequestLog">
        <Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.demo.request.log</Set>
        <Set name="retainDays">90</Set>
        <Set name="append">true</Set>
        <Set name="extended">true</Set>
        <Set name="LogTimeZone">GMT</Set>
      </New>
    </Set>
    -->

    <Call name="addHandler">
      <Arg><New class="org.mortbay.http.handler.ForwardHandler">
        <Call name="addForward"><Arg>/forward/*</Arg><Arg>/dump</Arg></Call>
        <!-- <Set name="rootForward">/dump/rootForward</Set> -->
      </New></Arg>
    </Call>

    <!-- Disabled as is not working in 4.2
    <Call name="addHandler">
      <Arg><New class="org.mortbay.http.handler.ContentEncodingHandler">
           <Call name="addPathSpec"><Arg>/images/*</Arg></Call>
           <Set name="minimumLength">512</Set>
      </New></Arg> 
    </Call>
    -->

    <Call name="addHandler">
      <Arg><New class="org.mortbay.http.handler.HTAccessHandler">
	    <Set name="AccessFile">.htaccess</Set>
      </New></Arg>
    </Call>

    <Call name="addServlet">
      <Arg>Invoker</Arg>
      <Arg>/servlet/*</Arg>
      <Arg>org.mortbay.jetty.servlet.Invoker</Arg>
    </Call>
    <Call name="addServlet">
      <Arg>Dump</Arg>
      <Arg>/dump/*:*.DUMP</Arg>
      <Arg>org.mortbay.servlet.Dump</Arg>
      <Put name="InitParam">Value</Put>
    </Call>
    <Call name="addServlet">
      <Arg>Session</Arg>
      <Arg>/session/*</Arg>
      <Arg>org.mortbay.servlet.SessionDump</Arg>
    </Call>
    <Call name="addServlet">
      <Arg>JSP</Arg>
      <Arg>*.jsp</Arg>
      <Arg>org.apache.jasper.servlet.JspServlet</Arg>
    </Call>   
    <Call name="addServlet">
      <Arg>SrcDefault</Arg>
      <Arg>/src/*</Arg>
      <Arg>org.mortbay.jetty.servlet.Default</Arg>
      <Call name="setInitParameter"><Arg>dirAllowed</Arg><Arg>true</Arg></Call>
      <Call name="setInitParameter">
        <Arg>resourceBase</Arg>
        <Arg><SystemProperty name="jetty.home" default="."/>/src/</Arg>
      </Call>
    </Call>   

    <Set name="ResourceBase"><SystemProperty name="jetty.home" default="."/>/demo/docroot/</Set>
    <Call name="addHandler">
      <Arg>
        <New class="org.mortbay.http.handler.ResourceHandler">
            <Set name="minGzipLength">8192</Set>
        </New>
      </Arg>
    </Call>

    <Call name="addHandler">
      <Arg><New class="org.mortbay.http.handler.DumpHandler"/></Arg>
    </Call>

    <Set name="ClassPath"><SystemProperty name="jetty.home" default="."/>/demo/servlets/</Set>
  </Call>



  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Build the cgi-bin context.                                      -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Call name="addContext">
    <Arg>/cgi-bin/*</Arg>
    <Set name="ResourceBase"><SystemProperty name="jetty.home" default="."/>/demo/cgi-bin/</Set>
    <Call name="addServlet">
      <Arg>Common Gateway Interface</Arg>
      <Arg>/</Arg>
      <Arg>org.mortbay.servlet.CGI</Arg>
      <!-- Set initParams for CGI -->
      <Put name="Path">/bin:/usr/bin:/usr/local/bin</Put>
      <!-- <Put name="commandPrefix">perl</Put> -->
    </Call>
  </Call>

  <!-- =============================================================== -->
  <!-- Configure the Authentication Realms                             -->
  <!-- =============================================================== -->
  <Call name="addRealm">
    <Arg>
      <New class="org.mortbay.http.HashUserRealm">
        <Arg>Jetty Demo Realm</Arg>
        <Arg><SystemProperty name="jetty.home" default="."/>/etc/demoRealm.properties</Arg>
      </New>
    </Arg>
  </Call>

  <Call name="addRealm">
    <Arg>
      <New class="org.mortbay.http.HashUserRealm">
        <Arg>Example Form-Based Authentication Area</Arg>
        <Arg><SystemProperty name="jetty.home" default="."/>/etc/examplesRealm.properties</Arg>
      </New>
    </Arg>
  </Call>

  <!-- =============================================================== -->
  <!-- Configure the Request Log                                       -->
  <!-- =============================================================== -->
  <Set name="RequestLog">
    <New class="org.mortbay.http.NCSARequestLog">
      <Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
      <Set name="retainDays">90</Set>
      <Set name="append">true</Set>
      <Set name="extended">true</Set>
      <Set name="LogTimeZone">GMT</Set>
      <Set name="ignorePaths">
        <Array type="String">
          <Item>/jetty/images/*</Item>
          <Item>/demo/images/*</Item>
          <Item>*.css</Item>
        </Array>
      </Set>
    </New>
  </Set>





  <!-- System classes cannot be overriden by a HttpContext or webapp -->
  <Set name="systemClasses">
    <Array type="java.lang.String">
      <Item>java.</Item>
      <Item>javax.servlet.</Item>
      <Item>javax.xml.</Item>
      <Item>org.mortbay.</Item>
      <Item>org.xml.</Item>
      <Item>org.w3c.</Item>
    </Array>
  </Set>

  <!-- Server classes are hidden from a HttpContext or webapp -->
  <Set name="serverClasses">
    <Array type="java.lang.String">
      <Item>-org.mortbay.http.PathMap</Item>
      <Item>-org.mortbay.</Item>
      <Item>org.mortbay.start.</Item>
      <Item>org.mortbay.stop.</Item>
      <Item>org.mortbay.jetty.Server</Item>    
    </Array>
  </Set>


</Configure>





