下面所有的信息都是基于jetty-9.0.5这个版本。
ps:
挂在eclipse基金会下其他知名开源框架还有 Sphinx(搜索服务器)Hudson(持续集成),Subversive(svn工具),AspectJ(aop框架),hadoop(离线计算)等
当你通过:java -jar start.jar 启动时候,读取的配置来之 $JETTY_HOME/start.ini
具体查看当前使用的配置 通过命令 java -jar start.jar –help 以下就是默认配置
——————————————————————————————-
The current start.ini arguments are:
OPTIONS=Server,websocket,resources,ext
threads.min=10
threads.max=200
threads.timeout=60000
jetty.dump.start=false
jetty.dump.stop=false
etc/jetty.xml
OPTIONS=jmx
etc/jetty-jmx.xml
OPTIONS=jsp
jetty.port=8080
http.timeout=30000
etc/jetty-http.xml
etc/jetty-deploy.xml
OPTIONS=rewrite
etc/jetty-rewrite.xml
etc/jetty-demo.xml
OPTIONS=client
etc/test-realm.xml
OPTIONS=jaas
jaas.login.conf=webapps.demo/test-jaas.d/login.conf
etc/jetty-jaas.xml
OPTIONS=jndi,jndi.demo
OPTIONS=plus
etc/jetty-plus.xml
OPTIONS=annotations
etc/jetty-annotations.xml
etc/jetty-ssl.xml
etc/jetty-https.xml
etc/jetty-demo.xml 中定义了默认启动加载的应用包 在webapps.demo目录 root路径的加载是在ROOT包下
———————————————
<Ref refid=”DeploymentManager”>
<Call id=”webappprovider” name=”addAppProvider”>
<Arg>
<New class=”org.eclipse.jetty.deploy.providers.WebAppProvider”>
<Set name=”monitoredDirName”><Property name=”jetty.home” default=”.” />/webapps.demo</Set>
<Set name=”defaultsDescriptor”><Property name=”jetty.home” default=”.” />/etc/webdefault.xml</Set>
另外jetty启动的JVM参数配置也在这里 vim start.ini
#===========================================================
# Configure JVM arguments.
# If JVM args are include in an ini file then –exec is needed
# to start a new JVM from start.jar with the extra args.
# If you wish to avoid an extra JVM running, place JVM args
# on the normal command line and do not use –exec
#———————————————————–
# –exec
# -Xmx2000m
# -Xmn512m
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- jetty 的每一示例都是一个Server --> <Configure id="Server" class="org.eclipse.jetty.server.Server"> <!-- 请求的线程池配置--> <Get name="ThreadPool"> <Set name="minThreads" type="int"><Property name="threads.min" default="10"/></Set> <Set name="maxThreads" type="int"><Property name="threads.max" default="200"/></Set> <Set name="idleTimeout" type="int"><Property name="threads.timeout" default="60000"/></Set> <Set name="detailedDump">false</Set> </Get> <!-- 线程的调度器 --> <Call name="addBean"> <Arg> <New class="org.eclipse.jetty.util.thread.ScheduledExecutorScheduler"/> </Arg> </Call> <!-- http https SPDY请求进来的默认配置 --> <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration"> <Set name="secureScheme">https</Set> <Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set> <Set name="outputBufferSize">32768</Set> <Set name="requestHeaderSize">8192</Set> <Set name="responseHeaderSize">8192</Set> <Set name="sendServerVersion">true</Set> <Set name="sendDateHeader">false</Set> <Set name="headerCacheSize">512</Set> <!-- Uncomment to enable handling of X-Forwarded- style headers <Call name="addCustomizer"> <Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg> </Call> --> </New> <!-- 请求的处理器,会处理Contexts中定义的handler 及默认的Handler--> <Set name="handler"> <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.eclipse.jetty.server.Handler"> <Item> <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> </Item> <Item> <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> </Item> </Array> </Set> </New> </Set> <!-- 其他配置选项 --> <Set name="stopAtShutdown">true</Set> <Set name="stopTimeout">5000</Set> <Set name="dumpAfterStart"><Property name="jetty.dump.start" default="false"/></Set> <Set name="dumpBeforeStop"><Property name="jetty.dump.stop" default="false"/></Set> </Configure>
定义了 应用加载包的信息
———————————————————————————————————-
<?xml version=”1.0″?>
<!DOCTYPE Configure PUBLIC “-//Jetty//Configure//EN” “http://www.eclipse.org/jetty/configure_9_0.dtd”>
<!– 定义包的部署管理 –>
<Configure id=”Server” class=”org.eclipse.jetty.server.Server”>
<Call name=”addBean”>
<Arg>
<New id=”DeploymentManager” class=”org.eclipse.jetty.deploy.DeploymentManager”>
<!– 加载的上下文目录 Contexts 的定义是在 jetty.xml中 –>
<Set name=”contexts”>
<Ref refid=”Contexts” />
</Set>
<Call name=”setContextAttribute”>
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/servlet-api-[^/]*\.jar$</Arg>
</Call>
<!– 应用的 provider 默认指向的是deploy目录 加载的配置是:/etc/webdefault.xml –>
<Call id=”webappprovider” name=”addAppProvider”>
<Arg>
<New class=”org.eclipse.jetty.deploy.providers.WebAppProvider”>
<Set name=”monitoredDirName”><Property name=”jetty.home” default=”.” />/webapps</Set>
<Set name=”defaultsDescriptor”><Property name=”jetty.home” default=”.” />/etc/webdefault.xml</Set>
<Set name=”scanInterval”>1</Set>
<Set name=”extractWars”>true</Set>
<Set name=”configurationManager”>
<New class=”org.eclipse.jetty.deploy.PropertiesConfigurationManager”>
<!– file of context configuration properties
<Set name=”file”><SystemProperty name=”jetty.home”/>/etc/some.properties</Set>
–>
<!– set a context configuration property
<Call name=”put”><Arg>name</Arg><Arg>value</Arg></Call>
–>
</New>
</Set>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>
</Configure>
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<!DOCTYPE Configure PUBLIC “-//Mort Bay Consulting//DTD Configure//EN” “http://jetty.mortbay.org/configure.dtd”>
<Configure class=”org.mortbay.jetty.webapp.WebAppContext”>
<Set name=”contextPath”>/</Set>
<Set name=”war”>/home/xx/xx.war</Set>
<Set name=”extractWAR”>true</Set>
<Set name=”copyWebDir”>false</Set>
</Configure>