<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">

<!-- =============================================================== -->
<!-- Documentation of this file format can be found at:              -->
<!-- https://www.eclipse.org/jetty/documentation/current/            -->
<!--                                                                 -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
<!-- and can be mixed in. See start.ini file for the default         -->
<!-- configuration files.                                            -->
<!--                                                                 -->
<!-- For a description of the configuration mechanism, see the       -->
<!-- output of:                                                      -->
<!--   java -jar start.jar -?                                        -->
<!-- =============================================================== -->

<!-- =============================================================== -->
<!-- Configure a Jetty Server instance with an ID "Server"           -->
<!-- Other configuration files may also configure the "Server"       -->
<!-- ID, in which case they are adding configuration to the same     -->
<!-- instance.  If other configuration have a different ID, they     -->
<!-- will create and configure another instance of Jetty.            -->
<!-- Consult the javadoc of o.e.j.server.Server for all              -->
<!-- configuration that may be set here.                             -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Arg name="threadPool"><Ref refid="threadPool"/></Arg>
    <Arg>
		<New class="org.eclipse.jetty.util.thread.ScheduledExecutorScheduler">
		  <Arg name="name"><Property name="jetty.scheduler.name"/></Arg>
		  <Arg name="daemon" type="boolean"><Property name="jetty.scheduler.daemon" default="false" /></Arg>
		  <Arg name="threads" type="int"><Property name="jetty.scheduler.threads" default="-1" /></Arg>
		</New>
	</Arg>
    <Arg><Ref refid="byteBufferPool"/></Arg>

    <!-- =========================================================== -->
    <!-- Http Configuration.                                         -->
    <!-- This is a common configuration instance used by all         -->
    <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, etc.)-->
    <!-- It configures the non wire protocol aspects of the HTTP     -->
    <!-- semantic.                                                   -->
    <!--                                                             -->
    <!-- This configuration is only defined here and is used by      -->
    <!-- reference from other XML files such as jetty-http.xml,      -->
    <!-- jetty-https.xml and other 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" property="jetty.httpConfig.secureScheme"/>
      <Set name="securePort" property="jetty.httpConfig.securePort"/>
      <Set name="outputBufferSize" property="jetty.httpConfig.outputBufferSize"/>
      <Set name="outputAggregationSize" property="jetty.httpConfig.outputAggregationSize"/>
      <Set name="requestHeaderSize" property="jetty.httpConfig.requestHeaderSize"/>
      <Set name="responseHeaderSize" property="jetty.httpConfig.responseHeaderSize"/>
      <Set name="sendServerVersion" property="jetty.httpConfig.sendServerVersion"/>
      <Set name="sendDateHeader"><Property name="jetty.httpConfig.sendDateHeader" default="false"/></Set>
      <Set name="headerCacheSize" property="jetty.httpConfig.headerCacheSize"/>
      <Set name="delayDispatchUntilContent" property="jetty.httpConfig.delayDispatchUntilContent"/>
      <Set name="maxErrorDispatches" property="jetty.httpConfig.maxErrorDispatches"/>
      <Set name="persistentConnectionsEnabled" property="jetty.httpConfig.persistentConnectionsEnabled"/>
      <Set name="httpCompliance"><Call class="org.eclipse.jetty.http.HttpCompliance" name="from"><Arg><Property name="jetty.httpConfig.compliance" deprecated="jetty.http.compliance" default="RFC7230"/></Arg></Call></Set>
      <Set name="uriCompliance"><Call class="org.eclipse.jetty.http.UriCompliance" name="from"><Arg><Property name="jetty.httpConfig.uriCompliance" default="DEFAULT"/></Arg></Call></Set>
      <Set name="requestCookieCompliance"><Call class="org.eclipse.jetty.http.CookieCompliance" name="from"><Arg><Property name="jetty.httpConfig.requestCookieCompliance" default="RFC6265"/></Arg></Call></Set>
      <Set name="responseCookieCompliance"><Call class="org.eclipse.jetty.http.CookieCompliance" name="from"><Arg><Property name="jetty.httpConfig.responseCookieCompliance" default="RFC6265"/></Arg></Call></Set>
      <Set name="relativeRedirectAllowed"><Property name="jetty.httpConfig.relativeRedirectAllowed" default="false"/></Set>
      <Set name="useInputDirectByteBuffers" property="jetty.httpConfig.useInputDirectByteBuffers"/>
      <Set name="useOutputDirectByteBuffers" property="jetty.httpConfig.useOutputDirectByteBuffers"/>
    </New>

    <!-- =========================================================== -->
    <!-- Set the handler structure for the Server                    -->
    <!-- =========================================================== -->
    <Set name="defaultHandler">
      <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
        <Arg name="serveFavIcon" type="boolean"><Property name="jetty.server.default.serveFavIcon" default="true"/></Arg>
        <Arg name="showContexts" type="boolean"><Property name="jetty.server.default.showContexts" default="true"/></Arg>
      </New>
    </Set>
    <Set name="handler">
      <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
        <Set name="dynamic" property="jetty.server.contexts.dynamic"/>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- extra server options                                        -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown"><Property name="jetty.server.stopAtShutdown" default="true"/></Set>
    <Set name="stopTimeout"><Property name="jetty.server.stopTimeout" default="5000"/></Set>
    <Set name="dumpAfterStart" property="jetty.server.dumpAfterStart"/>
    <Set name="dumpBeforeStop" property="jetty.server.dumpBeforeStop"/>
    <Set name="tempDirectory" property="jetty.server.tempDirectory"/>
	
    <!-- for jndi -->
    <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>
</Configure>
