jetty debug 启动 jettyconfig配置文件
jetty 代码启动 debug很简单 run----->>>debug as
代码启动配置文件
start 方法
@Test
public void serverStrart() throws Exception {
Server server = new Server();
XmlConfiguration configuration = new XmlConfiguration(new File(System.getProperty("user.dir")+"/etc/jetty_config.xml").toURI().toURL());
configuration.configure(server);
server.start();
server.join();
}
jetty_config.xml 通用配置:
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
<New class="org.mortbay.thread.BoundedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">250</Set>
<Set name="lowThreads">25</Set>
</New>
</Set>
<Property name="org.mortbay.util.URI.charset" default="GBK"/>
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">
<SystemProperty name="jetty.port" default="8888" /><!-- 端口号 -->
</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="sessionIdManager">
<New class="org.mortbay.jetty.servlet.HashSessionIdManager">
<Set name="workerName">node1</Set>
</New>
</Set>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection" />
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler" />
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler" />
</Item>
</Array>
</Set>
</New>
</Set>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set><!-- ContextPath -->
<Set name="resourceBase">F:/EDev/OA/Code/webapps/OA</Set><!-- Web应用根目录 -->
<Call name="addServlet">
<Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
<!-- 增加其它的Servlet -->
</New>
</Item>
</Array>
</Set>
</New>
</Set>
<Set name="UserRealms">
<Array type="org.mortbay.jetty.security.UserRealm"/>
</Set>
<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="gracefulShutdown">1000</Set>
</Configure>
posted on 2017-03-24 08:53 signheart 阅读(1403) 评论(0) 编辑 收藏 举报