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

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

    <!-- =========================================================== -->
    <!-- Add HTTP Customizer for Secure request                      -->
    <!-- =========================================================== -->
    <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
        <Set name="secureScheme">https</Set>
        <Set name="securePort">
            <SystemProperty name="jetty.spdy.port" default="8443"/>
        </Set>
        <Set name="outputBufferSize">32768</Set>
        <Set name="requestHeaderSize">8192</Set>
        <Set name="responseHeaderSize">8192</Set>
        <Call name="addCustomizer">
            <Arg>
                <New class="org.eclipse.jetty.server.SecureRequestCustomizer"/>
            </Arg>
        </Call>
    </New>


    <!-- =========================================================== -->
    <!-- Setup a SSL Context factory                                 -->
    <!-- =========================================================== -->
    <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
        <Set name="KeyStorePath"><Property name="jetty.home" default="."/>/etc/keystore
        </Set>
        <Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
        <Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
        <Set name="TrustStorePath"><Property name="jetty.home" default="."/>/etc/keystore
        </Set>
        <Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
    </New>

    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->
    <Call id="sslConnector" name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server">
                    <Ref refid="Server"/>
                </Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <Item>
                            <New class="org.eclipse.jetty.server.SslConnectionFactory">
                                <Arg name="next">alpn</Arg>
                                <Arg name="sslContextFactory">
                                    <Ref refid="sslContextFactory"/>
                                </Arg>
                            </New>
                        </Item>

                        <Item>
                            <New class="org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory">
                                <Arg name="protocols">
                                    <Array type="String">
                                        <Item>spdy/3</Item>
                                        <Item>spdy/2</Item>
                                        <Item>http/1.1</Item>
                                    </Array>
                                </Arg>
                                <Set name="defaultProtocol">http/1.1</Set>
                            </New>
                        </Item>

                        <Item>
                            <New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
                                <Arg name="version" type="int">3</Arg>
                                <Arg name="config">
                                    <Ref refid="httpConfig"/>
                                </Arg>
                                <!-- Set the initial window size for this SPDY connector. -->
                                <!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
                                <Set name="initialWindowSize">65536</Set>
                            </New>
                        </Item>

                        <Item>
                            <New class="org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnectionFactory">
                                <Arg name="version" type="int">2</Arg>
                                <Arg name="config">
                                    <Ref refid="httpConfig"/>
                                </Arg>
                                <!-- Set the initial window size for this SPDY connector. -->
                                <!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
                                <Set name="initialWindowSize">65536</Set>
                            </New>
                        </Item>

                        <Item>
                            <New class="org.eclipse.jetty.server.HttpConnectionFactory">
                                <Arg name="config">
                                    <Ref refid="httpConfig"/>
                                </Arg>
                            </New>
                        </Item>
                    </Array>
                </Arg>
                <Set name="host">
                    <Property name="jetty.host"/>
                </Set>
                <Set name="port">
                    <SystemProperty name="jetty.spdy.port" default="8443"/>
                </Set>
                <Set name="idleTimeout">30000</Set>
            </New>
        </Arg>
    </Call>

</Configure>
