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


<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- Documentation of this file format can be found at:              -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax        -->
<!-- =============================================================== -->

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

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <Arg name="threadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">10</Set>
        <Set name="maxThreads">200</Set>
      </New>
    </Arg>
    
    <!-- =========================================================== -->
    <!-- Http Configuration.                                         -->
    <!-- This is a common configuration instance used by all         -->
    <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
    <!-- It configures the non wire protocol aspects of the HTTP     -->
    <!-- semantic.                                                   -->
    <!--                                                             -->
    <!-- This configuration is only defined here and is used by      -->
    <!-- reference from the jetty-http.xml, jetty-https.xml and      -->
    <!-- jetty-spdy.xml configuration files which instantiate the    -->
    <!-- connectors.                                                 -->
    <!--                                                             -->
    <!-- Consult the javadoc of o.e.j.server.HttpConfiguration       -->
    <!-- for all configuration that may be set here.                 -->
    <!-- =========================================================== -->
    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
      <Set name="secureScheme">https</Set>
      <Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
      <Set name="outputBufferSize">32768</Set>
      <Set name="requestHeaderSize">8192</Set>
      <Set name="responseHeaderSize">8192</Set>
      <Set name="sendServerVersion">true</Set>
      <Set name="sendDateHeader">false</Set>
      <Set name="headerCacheSize">512</Set>

      <!-- Uncomment to enable handling of X-Forwarded- style headers --> 
      <Call name="addCustomizer">
        <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
      </Call>
    </New>
    
    <New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
      <Arg><Ref refid="httpConfig"/></Arg>
      <Call name="addCustomizer">
        <Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
      </Call>
    </New>

    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            -->
    <!-- =========================================================== -->
    <Set name="handler">
      <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
        <Set name="handlers">
         <Array type="org.eclipse.jetty.server.Handler">
           <Item>
             <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
           </Item>
           <Item>
             <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
           </Item>
           <Item>
             <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>
	
	<Ref id="RequestLog">
  	<Set name="requestLog">
      <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
        <Arg>{{ ACCESS_LOG }}/jetty-yyyy_mm_dd.request.log</Arg>
        <Set name="retainDays">30</Set>
        <Set name="append">true</Set>
        <Set name="extended">false</Set>
        <Set name="LogTimeZone">GMT</Set>
       </New>
      </Set>
	</Ref>


    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">false</Set>
    <Set name="stopTimeout">30000</Set>
    <Set name="dumpAfterStart">false</Set>
    <Set name="dumpBeforeStop">false</Set>

    <!-- =========================================================== -->
    <!-- jetty-jndi by default                                       -->
    <!-- =========================================================== -->
    <Call class="java.lang.System" name="setProperty">
      <Arg>java.naming.factory.initial</Arg>
      <Arg><Property name="java.naming.factory.initial" default="org.eclipse.jetty.jndi.InitialContextFactory"/></Arg>
    </Call>
    <Call class="java.lang.System" name="setProperty">
      <Arg>java.naming.factory.url.pkgs</Arg>
      <Arg><Property name="java.naming.factory.url.pkgs" default="org.eclipse.jetty.jndi"/></Arg>
    </Call>
	 
	<!-- =========================================================== -->
    <!-- jetty configuration 										 -->
    <!-- =========================================================== -->
	<!--
    <Call class="org.eclipse.jetty.webapp.Configuration$ClassList" name="setServerDefault">
      <Arg><Ref refid="Server" /></Arg>
      <Call name="addAfter">
        <Arg name="afterClass">org.eclipse.jetty.webapp.FragmentConfiguration</Arg>
        <Arg>
          <Array type="String">
            <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
            <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
            <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>
          </Array>
        </Arg>
      </Call>
     </Call>
	 -->
 
   <!-- =========================================================== -->
   <!-- jetty-jndi global value override (rola) 					-->
   <!-- =========================================================== -->
	 <New class="org.eclipse.jetty.plus.jndi.EnvEntry">
		<Arg></Arg>
		<Arg>rola/config</Arg>
		<Arg type="java.lang.String">[DEFAULT]</Arg>
		 <Arg type="boolean">true</Arg>
	 </New>
   
   <!-- =============================================================== -->
   <!-- Set customized rola error handler                               -->
   <!-- (set in jetty.xml & httpservice.xml & jetty-webapp-context.xml) -->
   <!-- =============================================================== -->
   <Call name="addBean">
    <Arg>
     <New class="com.rola.rscase.web.common.JettyErrorHandler">
      <Set name="showStacks"><SystemProperty name="jetty.errorhandler.showstacks" default="true" /></Set>
      <Set name="server"><Ref refid="Server"/></Set>
    </New>
    </Arg>
  </Call>
</Configure>
