<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <Set name="ThreadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">25</Set>
        <Set name="maxThreads">250</Set>
      </New>
    </Set>

    <Call name="addConnector">
        <Arg>
          <!-- Use this connector to use SSL and run openBIS on 8443 port -->
          <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
	             <Set name="Port">8443</Set>
	                 <Set name="maxIdleTime">300000</Set>
                   <Set name="Acceptors">2</Set>
                   <Set name="AcceptQueueSize">100</Set>
	                 <Set name="Keystore">
	                     <SystemProperty name="jetty.home" default="." />/etc/openBIS.keystore
	                 </Set>
                  <Set name="Password">changeit</Set>
                  <Set name="KeyPassword">changeit</Set>
          </New>
          <!-- Use this connector and remove the one above to switch off SSL and run openBIS on 8080 port -->
          <!-- 
          <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
             <Set name="Port">8080</Set>
             <Set name="maxIdleTime">300000</Set>
             <Set name="Acceptors">2</Set>
             <Set name="AcceptQueueSize">100</Set>
          </New>
          -->
        </Arg>
    </Call>

    <Set name="handler">
        <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
    </Set>

    <Call name="addBean">
      <Arg>
        <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
          <Set name="contexts">
            <Ref id="Contexts" />
          </Set>
          <Call name="addAppProvider">
            <Arg>
              <New class="ch.systemsx.cisd.openbis.generic.server.util.OpenbisWebAppProvider">
                <Set name="monitoredDir"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="scanInterval">0</Set>
                <Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
        </New>
      </Arg>
    </Call>
    
    <Call name="addLifeCycleListener">
      <Arg><New class="ch.systemsx.cisd.openbis.generic.server.util.LifeCycleListener"/></Arg>
    </Call>

    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->

    <Set name="stopAtShutdown">true</Set>
    <Set name="sendServerVersion">true</Set>
    <Set name="sendDateHeader">true</Set>
    <Set name="gracefulShutdown">1000</Set>

</Configure>
