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

<!-- ========================================================================== -->
<!-- Configure the Jetty Server instance with an ID "Proxy"                     -->
<!-- by adding a proxy functionalities.                                         -->
<!-- ========================================================================== -->
<Configure id="Proxy" class="org.eclipse.jetty.server.Server">

    <Arg name="threadpool">
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">16</Set>
        <Set name="maxThreads">256</Set>
      </New>
    </Arg>

    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.ServerConnector">
            <Arg name="server"><Ref refid="Proxy" /></Arg>
            <Set name="host"><Property name="jetty.host" /></Set>
            <Set name="port"><Property name="jetty.port" default="8888"/></Set>
            <Set name="idleTimeout">300000</Set>
          </New>
      </Arg>
    </Call>

    <Set name="handler">
        <New class="org.eclipse.jetty.proxy.ConnectHandler">
            <Set name="handler">
              <New class="org.eclipse.jetty.servlet.ServletHandler">
                <Call id="proxyHolder" name="addServletWithMapping">
                  <Arg>org.eclipse.jetty.proxy.ProxyServlet</Arg>
                  <Arg>/</Arg>
                    <Call name="setInitParameter">
                        <Arg>maxThreads</Arg>
                        <Arg>128</Arg>
                    </Call>
                </Call>
              </New>
            </Set>
        </New>
    </Set>

    <Set name="stopAtShutdown">true</Set>
    <Set name="stopTimeout">1000</Set>

</Configure>
