jetty debug 启动 jettyconfig配置文件



jetty 代码启动 debug很简单  run----->>>debug as 


代码启动配置文件

start 方法

  1. @Test
  2. public void serverStrart() throws Exception {
  3. Server server = new Server();
  4. XmlConfiguration configuration = new XmlConfiguration(new File(System.getProperty("user.dir")+"/etc/jetty_config.xml").toURI().toURL());
  5. configuration.configure(server);
  6. server.start();
  7. server.join();
  8. }


jetty_config.xml 通用配置:

  1. <?xml version="1.0" encoding="GBK"?>
  2. <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
  3. <Configure id="Server" class="org.mortbay.jetty.Server">
  4. <Set name="ThreadPool">
  5. <New class="org.mortbay.thread.BoundedThreadPool">
  6. <Set name="minThreads">10</Set>
  7. <Set name="maxThreads">250</Set>
  8. <Set name="lowThreads">25</Set>
  9. </New>
  10. </Set>
  11. <Property name="org.mortbay.util.URI.charset" default="GBK"/>
  12. <Call name="addConnector">
  13. <Arg>
  14. <New class="org.mortbay.jetty.nio.SelectChannelConnector">
  15. <Set name="port">
  16. <SystemProperty name="jetty.port" default="8888" /><!-- 端口号 -->
  17. </Set>
  18. <Set name="maxIdleTime">30000</Set>
  19. <Set name="Acceptors">2</Set>
  20. <Set name="statsOn">false</Set>
  21. <Set name="confidentialPort">8443</Set>
  22. <Set name="lowResourcesConnections">5000</Set>
  23. <Set name="lowResourcesMaxIdleTime">5000</Set>
  24. </New>
  25. </Arg>
  26. </Call>
  27. <Set name="sessionIdManager">
  28. <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
  29. <Set name="workerName">node1</Set>
  30. </New>
  31. </Set>
  32. <Set name="handler">
  33. <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
  34. <Set name="handlers">
  35. <Array type="org.mortbay.jetty.Handler">
  36. <Item>
  37. <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection" />
  38. </Item>
  39. <Item>
  40. <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler" />
  41. </Item>
  42. <Item>
  43. <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler" />
  44. </Item>
  45. </Array>
  46. </Set>
  47. </New>
  48. </Set>
  49. <Set name="handler">
  50. <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
  51. <Set name="handlers">
  52. <Array type="org.mortbay.jetty.Handler">
  53. <Item>
  54. <New class="org.mortbay.jetty.webapp.WebAppContext">
  55. <Set name="contextPath">/</Set><!-- ContextPath -->
  56. <Set name="resourceBase">F:/EDev/OA/Code/webapps/OA</Set><!-- Web应用根目录 -->
  57. <Call name="addServlet">
  58. <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
  59. <Arg>/</Arg>
  60. </Call>
  61. <!-- 增加其它的Servlet -->
  62. </New>
  63. </Item>
  64. </Array>
  65. </Set>
  66. </New>
  67. </Set>
  68. <Set name="UserRealms">
  69. <Array type="org.mortbay.jetty.security.UserRealm"/>
  70. </Set>
  71. <Set name="stopAtShutdown">true</Set>
  72. <Set name="sendServerVersion">true</Set>
  73. <Set name="gracefulShutdown">1000</Set>
  74. </Configure>

posted on 2017-03-24 08:53  signheart  阅读(1403)  评论(0编辑  收藏  举报

导航