Jetty 提供了一个 web 服务器和 servlet 容器,另外还提供了对 HTTP/2、 WebSocket、 OSGi、 JMX、 JNDI、 JAAS 和许多其他集成的支持。这些组件是开放源码的,可以免费用于商业用途和分发。
在开发和生产中,Jetty 被广泛应用于各种项目和产品中。Jetty 长期以来深受开发人员的喜爱,因为它可以轻松地嵌入到设备、工具、框架、应用服务器和现代云服务中。
下载地址 https://www.eclipse.org/jetty/download.html
参考文档 Jetty : The Definitive Reference (eclipse.org)
启动和关闭服务脚本
service jetty start
service jetty stop
[/opt/jetty]# tar -zxf /home/user/downloads/jetty-distribution-{VERSION}.tar.gz
[/opt/jetty]# cd jetty-distribution-{VERSION}/
[/opt/jetty/jetty-distribution-{VERSION}]# ls
bin lib modules resources start.jar
demo-base license-eplv10-aslv20.html notice.html start.d VERSION.txt
etc logs README.TXT start.ini webapps
[/opt/jetty/jetty-distribution-{VERSION}]# cp bin/jetty.sh /etc/init.d/jetty
[/opt/jetty/jetty-distribution-{VERSION}]# echo JETTY_HOME=`pwd` > /etc/default/jetty
[/opt/jetty/jetty-distribution-{VERSION}]# cat /etc/default/jetty
JETTY_HOME=/opt/jetty/jetty-distribution-{VERSION}
[/opt/jetty/jetty-distribution-{VERSION}]# service jetty start
Starting Jetty: OK Wed Nov 20 10:26:53 MST 2013
<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="8081" /></Set>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/jenkins</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/jenkins.war</Set>
<Get name="securityHandler">
<Set name="loginService">
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Jenkins Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/demo-base/etc/realm.properties</Set>
</New>
</Set>
</Get>
</Configure>
问题:jetty 隔几天凌晨定时出现404错误(linux /tmp/) 解决方案:(jetty.home)/work下创建一个统一的work目录,这样最方便部署。