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

<!-- ======================================================================= -->
<!-- Configure the rdf-delta Jetty server to support *only* HTTPS requests.  -->
<!-- Keep various other settings (thread pool size, request/response sizes)  -->
<!-- consistent with their settings when a Jetty XML file is not specified.  -->
<!-- ======================================================================= -->

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

  <Get name="threadPool">
    <Set name="minThreads" type="int">4</Set>
    <Set name="maxThreads" type="int">50</Set>
  </Get>

  <New id="httpsSRC" class="org.eclipse.jetty.server.SecureRequestCustomizer">
    <Set name="sniHostCheck" type="boolean">false</Set> <!-- NB! -->
  </New>

  <New id="httpsConfig" class="org.eclipse.jetty.server.HttpConfiguration">
    <Call name="addCustomizer">
      <Arg><Ref refid="httpsSRC" /></Arg>
    </Call>
  </New>

  <New id="https" class="org.eclipse.jetty.server.HttpConnectionFactory">
    <Arg name="config"><Ref refid="httpsConfig" /></Arg>

    <Get name="httpConfiguration">
      <Set name="requestHeaderSize" type="int">524288</Set>
      <Set name="outputBufferSize" type="int">5242880</Set>
      <Set name="sendServerVersion" type="boolean">false</Set>
	</Get>

    <Get id="http11Protocol" name="protocol" />
  </New>

  <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
    <Set name="keyStorePath" type="String">/PATH/TO/KEY_STORE</Set>
    <Set name="keyStorePassword" type="String">KEY_STORE_PASSWORD</Set>
    <Set name="keyManagerPassword" type="String">KEY_MANAGER_PASSWORD</Set>
  </New>

  <New id="tls" class="org.eclipse.jetty.server.SslConnectionFactory">
    <Arg name="sslContextFactory"><Ref refid="sslContextFactory" /></Arg>
    <Arg name="next"><Ref refid="http11Protocol" /></Arg>
  </New>

  <New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
    <Arg name="server"><Ref refid="server" /></Arg>
    <Arg name="factories">
	  <Array type="org.eclipse.jetty.server.ConnectionFactory">
	    <Item><Ref refid="tls" /></Item>
	    <Item><Ref refid="https" /></Item>
	  </Array>
	</Arg>

    <Set name="port" type="int">1066</Set>
  </New>

  <Call name="addConnector">
    <Arg><Ref refid="sslConnector" /></Arg>
  </Call>

</Configure>
