jetty.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <?xml version="1.0"?>
  2. <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
  3. <!-- =============================================================== -->
  4. <!-- Configure the Jetty Server -->
  5. <!-- -->
  6. <!-- Documentation of this file format can be found at: -->
  7. <!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
  8. <!-- -->
  9. <!-- =============================================================== -->
  10. <Configure id="Server" class="org.eclipse.jetty.server.Server">
  11. <!-- =========================================================== -->
  12. <!-- Configure the Server Thread Pool. -->
  13. <!-- The server holds a common thread pool which is used by -->
  14. <!-- default as the executor used by all connectors and servlet -->
  15. <!-- dispatches. -->
  16. <!-- -->
  17. <!-- Configuring a fixed thread pool is vital to controlling the -->
  18. <!-- maximal memory footprint of the server and is a key tuning -->
  19. <!-- parameter for tuning. In an application that rarely blocks -->
  20. <!-- then maximal threads may be close to the number of 5*CPUs. -->
  21. <!-- In an application that frequently blocks, then maximal -->
  22. <!-- threads should be set as high as possible given the memory -->
  23. <!-- available. -->
  24. <!-- -->
  25. <!-- Consult the javadoc of o.e.j.util.thread.QueuedThreadPool -->
  26. <!-- for all configuration that may be set here. -->
  27. <!-- =========================================================== -->
  28. <Arg name="threadpool">
  29. <New id="threadpool" class="com.codahale.metrics.jetty9.InstrumentedQueuedThreadPool">
  30. <Arg name="registry">
  31. <Call id="solrJettyMetricRegistry" name="getOrCreate" class="com.codahale.metrics.SharedMetricRegistries">
  32. <Arg>solr.jetty</Arg>
  33. </Call>
  34. </Arg>
  35. </New>
  36. </Arg>
  37. <Get name="ThreadPool">
  38. <Set name="minThreads" type="int"><Property name="solr.jetty.threads.min" default="10"/></Set>
  39. <Set name="maxThreads" type="int"><Property name="solr.jetty.threads.max" default="10000"/></Set>
  40. <Set name="idleTimeout" type="int"><Property name="solr.jetty.threads.idle.timeout" default="120000"/></Set>
  41. <Set name="stopTimeout" type="int"><Property name="solr.jetty.threads.stop.timeout" default="60000"/></Set>
  42. <Set name="detailedDump">false</Set>
  43. </Get>
  44. <!-- =========================================================== -->
  45. <!-- Http Configuration. -->
  46. <!-- This is a common configuration instance used by all -->
  47. <!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
  48. <!-- It configures the non wire protocol aspects of the HTTP -->
  49. <!-- semantic. -->
  50. <!-- -->
  51. <!-- This configuration is only defined here and is used by -->
  52. <!-- reference from the jetty-http.xml, jetty-https.xml and -->
  53. <!-- jetty-spdy.xml configuration files which instantiate the -->
  54. <!-- connectors. -->
  55. <!-- -->
  56. <!-- Consult the javadoc of o.e.j.server.HttpConfiguration -->
  57. <!-- for all configuration that may be set here. -->
  58. <!-- =========================================================== -->
  59. <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
  60. <Set name="secureScheme">https</Set>
  61. <Set name="securePort"><Property name="solr.jetty.secure.port" default="8443" /></Set>
  62. <Set name="outputBufferSize"><Property name="solr.jetty.output.buffer.size" default="32768" /></Set>
  63. <Set name="outputAggregationSize"><Property name="solr.jetty.output.aggregation.size" default="8192" /></Set>
  64. <Set name="requestHeaderSize"><Property name="solr.jetty.request.header.size" default="8192" /></Set>
  65. <Set name="responseHeaderSize"><Property name="solr.jetty.response.header.size" default="8192" /></Set>
  66. <Set name="sendServerVersion"><Property name="solr.jetty.send.server.version" default="false" /></Set>
  67. <Set name="sendDateHeader"><Property name="solr.jetty.send.date.header" default="false" /></Set>
  68. <Set name="headerCacheSize"><Property name="solr.jetty.header.cache.size" default="512" /></Set>
  69. <Set name="delayDispatchUntilContent"><Property name="solr.jetty.delayDispatchUntilContent" default="false"/></Set>
  70. <!-- Uncomment to enable handling of X-Forwarded- style headers
  71. <Call name="addCustomizer">
  72. <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
  73. </Call>
  74. -->
  75. </New>
  76. <!-- =========================================================== -->
  77. <!-- RewriteHandle to redirect root to Solr -->
  78. <!-- =========================================================== -->
  79. <New id="RewriteHandler" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
  80. <Set name="rewriteRequestURI">true</Set>
  81. <Set name="rewritePathInfo">false</Set>
  82. <Set name="originalPathAttribute">requestedPath</Set>
  83. <Call name="addRule">
  84. <Arg>
  85. <New class="org.eclipse.jetty.rewrite.handler.RedirectRegexRule">
  86. <Set name="regex">^/$</Set>
  87. <Set name="replacement">/solr/</Set>
  88. </New>
  89. </Arg>
  90. </Call>
  91. <Call name="addRule">
  92. <Arg>
  93. <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
  94. <Set name="pattern">/v2/*</Set>
  95. <Set name="replacement">/solr/____v2</Set>
  96. </New>
  97. </Arg>
  98. </Call>
  99. <Call name="addRule">
  100. <Arg>
  101. <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
  102. <Set name="pattern">/api/*</Set>
  103. <Set name="replacement">/solr/____v2</Set>
  104. </New>
  105. </Arg>
  106. </Call>
  107. <Set name="handler">
  108. <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
  109. <Set name="handlers">
  110. <Array type="org.eclipse.jetty.server.Handler">
  111. <Item>
  112. <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
  113. </Item>
  114. <Item>
  115. <New id="InstrumentedHandler" class="com.codahale.metrics.jetty9.InstrumentedHandler">
  116. <Arg><Ref refid="solrJettyMetricRegistry"/></Arg>
  117. <Set name="handler">
  118. <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
  119. </Set>
  120. </New>
  121. </Item>
  122. <Item>
  123. <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
  124. </Item>
  125. </Array>
  126. </Set>
  127. </New>
  128. </Set>
  129. </New>
  130. <!-- =========================================================== -->
  131. <!-- Set handler Collection Structure -->
  132. <!-- =========================================================== -->
  133. <Set name="handler">
  134. <Ref id="RewriteHandler"/>
  135. </Set>
  136. <!-- =========================================================== -->
  137. <!-- Configure Request Log -->
  138. <!-- =========================================================== -->
  139. <!--
  140. <Ref id="Handlers">
  141. <Call name="addHandler">
  142. <Arg>
  143. <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
  144. <Set name="requestLog">
  145. <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
  146. <Set name="filename">
  147. logs/request.yyyy_mm_dd.log
  148. </Set>
  149. <Set name="filenameDateFormat">yyyy_MM_dd</Set>
  150. <Set name="retainDays">90</Set>
  151. <Set name="append">true</Set>
  152. <Set name="extended">false</Set>
  153. <Set name="logCookies">false</Set>
  154. <Set name="LogTimeZone">UTC</Set>
  155. </New>
  156. </Set>
  157. </New>
  158. </Arg>
  159. </Call>
  160. </Ref>
  161. -->
  162. <!-- =========================================================== -->
  163. <!-- extra options -->
  164. <!-- =========================================================== -->
  165. <Set name="stopAtShutdown">true</Set>
  166. <Set name="dumpAfterStart">false</Set>
  167. <Set name="dumpBeforeStop">false</Set>
  168. <Call name="addBean">
  169. <Arg>
  170. <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
  171. <Set name="contexts">
  172. <Ref refid="Contexts" />
  173. </Set>
  174. <Call name="setContextAttribute">
  175. <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
  176. <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
  177. </Call>
  178. <Call name="addAppProvider">
  179. <Arg>
  180. <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
  181. <Set name="monitoredDirName"><Property name="jetty.base" default="."/>/contexts</Set>
  182. <Set name="scanInterval">0</Set>
  183. </New>
  184. </Arg>
  185. </Call>
  186. <!-- Add a customize step to the deployment lifecycle -->
  187. <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
  188. <Call name="insertLifeCycleNode">
  189. <Arg>deployed</Arg>
  190. <Arg>starting</Arg>
  191. <Arg>customise</Arg>
  192. </Call>
  193. <Call name="addLifeCycleBinding">
  194. <Arg>
  195. <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
  196. <Arg>customise</Arg>
  197. </New>
  198. </Arg>
  199. </Call>
  200. -->
  201. </New>
  202. </Arg>
  203. </Call>
  204. </Configure>