Advertisement
Guest User

jetty.xml

a guest
Jan 18th, 2013
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0"?>
  2. <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
  3.  
  4. <!-- ============================================================= -->
  5. <!-- Configure the Jetty Server instance with an ID "Server"       -->
  6. <!-- by adding a HTTPS connector.                                  -->
  7. <!-- This configuration must be used in conjunction with jetty.xml -->
  8. <!-- It should not be used with jetty-spdy.xml which can provide   -->
  9. <!-- both HTTPS and SPDY connections                               -->
  10. <!-- ============================================================= -->
  11. <Configure id="Server" class="org.eclipse.jetty.server.Server">
  12.  
  13.     <!-- Esto cogido de http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/jetty.xml -->
  14.    
  15.  
  16.     <!-- =========================================================== -->
  17.     <!-- Http Configuration.                                         -->
  18.     <!-- This is a common configuration instance used by all         -->
  19.     <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
  20.     <!-- It configures the non wire protocol aspects of the HTTP     -->
  21.     <!-- semantic.                                                   -->
  22.     <!--                                                             -->
  23.     <!-- This configuration is only defined here and is used by      -->
  24.     <!-- reference from the jetty-http.xml, jetty-https.xml and      -->
  25.     <!-- jetty-spdy.xml configuration files which instantiate the    -->
  26.     <!-- connectors.                                                 -->
  27.     <!--                                                             -->
  28.     <!-- Consult the javadoc of o.e.j.server.HttpConfiguration       -->
  29.     <!-- for all configuration that may be set here.                 -->
  30.     <!-- =========================================================== -->
  31.     <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
  32.       <Set name="secureScheme">https</Set>
  33.       <Set name="securePort"><Property name="jetty.tls.port" default="8443" /></Set>
  34.       <Set name="outputBufferSize">32768</Set>
  35.       <Set name="requestHeaderSize">8192</Set>
  36.       <Set name="responseHeaderSize">8192</Set>
  37.      
  38.       <!-- Uncomment to enable handling of X-Forwarded- style headers
  39.      <Call name="addCustomizer">
  40.        <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
  41.      </Call>
  42.      -->
  43.     </New>
  44.    
  45.  
  46.    
  47.     <!-- =========================================================== -->
  48.     <!-- Set the default handler structure for the Server            -->
  49.     <!-- A handler collection is used to pass received requests to   -->
  50.     <!-- both the ContextHandlerCollection, which selects the next   -->
  51.     <!-- handler by context path and virtual host, and the           -->
  52.     <!-- DefaultHandler, which handles any requests not handled by   -->
  53.     <!-- the context handlers.                                       -->
  54.     <!-- Other handlers may be added to the "Handlers" collection,   -->
  55.     <!-- for example the jetty-requestlog.xml file adds the          -->
  56.     <!-- RequestLogHandler after the default handler                 -->
  57.     <!-- =========================================================== -->
  58.     <Set name="handler">
  59.       <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
  60.         <Set name="handlers">
  61.          <Array type="org.eclipse.jetty.server.Handler">
  62.            <Item>
  63.              <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
  64.            </Item>
  65.            <Item>
  66.              <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
  67.            </Item>
  68.          </Array>
  69.         </Set>
  70.       </New>
  71.     </Set>
  72.  
  73.  
  74.  
  75.     <!-- Fin jetty.xml -->
  76.     <!-- Comienza jetty-https.xml -->
  77.  
  78.   <!-- =========================================================== -->
  79.   <!-- Setup the SSL Context factory used to establish all TLS     -->
  80.   <!-- Connections and session.                                    -->
  81.   <!--                                                             -->
  82.   <!-- Consult the javadoc of o.e.j.util.ssl.SslContextFactory     -->
  83.   <!-- o.e.j.server.HttpConnectionFactory for all configuration    -->
  84.   <!-- that may be set here.                                       -->
  85.   <!-- =========================================================== -->
  86.   <!--
  87.  <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
  88.    <Set name="KeyStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
  89.    <Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
  90.    <Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
  91.    <Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
  92.    <Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
  93.  </New>
  94.   -->
  95.    
  96.    <!-- TODO: Mejorar paths y ofuscar contraseñas
  97.   http://docs.codehaus.org/display/JETTY/Securing+Passwords
  98.   -->
  99.    <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
  100.     <Set name="KeyStorePath"><Property name="jetty.home" default="." />/target/jetty-ssl.keystore</Set>
  101.     <Set name="KeyStorePassword">******</Set>
  102.     <Set name="KeyManagerPassword">******</Set>
  103.     <Set name="TrustStorePath"><Property name="jetty.home" default="." />/src/main/resources/entidades.truststore</Set>
  104.     <Set name="TrustStorePassword">*******</Set>
  105.     <!--<Set name="wantClientAuth">true</Set>-->
  106.     <!-- <Set name="needClientAuth">true</Set>  -->
  107.     <Set name="protocol">TLSv1</Set>
  108.   </New>
  109.  
  110.  
  111.  
  112.   <!-- =========================================================== -->
  113.   <!-- Create a TLS specific HttpConfiguration based on the        -->
  114.   <!-- common HttpConfiguration defined in jetty.xml               -->
  115.   <!-- Add a SecureRequestCustomizer to extract certificate and    -->
  116.   <!-- session information                                         -->
  117.   <!-- =========================================================== -->
  118.   <New id="tlsHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
  119.     <Arg><Ref id="httpConfig"/></Arg>
  120.     <Call name="addCustomizer">
  121.       <Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
  122.     </Call>
  123.   </New>
  124.  
  125.  
  126.   <!-- =========================================================== -->
  127.   <!-- Add a HTTPS Connector.                                      -->
  128.   <!-- Configure an o.e.j.server.ServerConnector with connection   -->
  129.   <!-- factories for TLS (aka SSL) and HTTP to provide HTTPS.      -->
  130.   <!-- All accepted TLS connections are wired to a HTTP connection.-->
  131.   <!--                                                             -->
  132.   <!-- Consult the javadoc of o.e.j.server.ServerConnector,        -->
  133.   <!-- o.e.j.server.SslConnectionFactory and                       -->
  134.   <!-- o.e.j.server.HttpConnectionFactory for all configuration    -->
  135.   <!-- that may be set here.                                       -->
  136.   <!-- =========================================================== -->
  137.   <Call id="sslConnector" name="addConnector">
  138.     <Arg>
  139.       <New class="org.eclipse.jetty.server.ServerConnector">
  140.         <Arg name="server"><Ref id="Server" /></Arg>
  141.           <Arg name="factories">
  142.             <Array type="org.eclipse.jetty.server.ConnectionFactory">
  143.               <Item>
  144.                 <New class="org.eclipse.jetty.server.SslConnectionFactory">
  145.                   <Arg name="next">http/1.1</Arg>
  146.                   <Arg name="sslContextFactory"><Ref id="sslContextFactory"/></Arg>
  147.                 </New>
  148.               </Item>
  149.               <Item>
  150.                 <New class="org.eclipse.jetty.server.HttpConnectionFactory">
  151.                   <Arg name="config"><Ref id="tlsHttpConfig"/></Arg>
  152.                 </New>
  153.               </Item>
  154.             </Array>
  155.           </Arg>
  156.           <Set name="host"><Property name="jetty.host" /></Set>
  157.           <Set name="port"><Property name="jetty.tls.port" default="8443" /></Set>
  158.           <Set name="idleTimeout">30000</Set>
  159.         </New>
  160.     </Arg>
  161.   </Call>
  162.  
  163.  </Configure>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement