没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
jetty快速入门与嵌入使用 jetty
看到开源项目发布的时候都带一个 jsp 容器(jetty)。拿来做 demo、开发、调试的服务器还是很不错的。今天就小试下,主要把它运行起来。
第一步下载:http://dist.codehaus.org/jetty/jetty-6.1.14/jetty-6.1.14.zip 是目前最新的稳定版。解压到如E:\jetty-6.1.14,其中比较重要的目录是:etc、contexts、webapps。个人认为可以类比 tomcat的conf、conf\Catalina\localhost、webapps目录。contexts是热部署用的。
试运行下,可以把一个简单的web项目到到webapps目录下,或是*.war,如:web-demo(或web-demo.war)放到webapps目录下。
E:\jetty-6.1.14>java -jar start.jar
2009-01-13 15:34:38.937::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2009-01-13 15:34:39.265::INFO: jetty-6.1.14
2009-01-13 15:34:39.421::INFO: Deploy E:\jetty-6.1.14\contexts\javadoc.xml -> org.mortbay.jetty.handler.ContextHandler@15cda3f{/javadoc,file:/E:/jetty-6.1.14/javadoc/}
...
2009-01-13 15:35:01.828::INFO: Opened E:\jetty-6.1.14\logs\2009_01_13.request.log
2009-01-13 15:35:01.953::INFO: Started SelectChannelConnector@127.0.0.1:8080
打开:http://localhost:8080/web-demo ,恩有结果了。
如果不把web-demo放到webapps目录下也可,在contexts目录下建立一个文件告诉jetty就行了。可以在contexts目录下复制test.xml为web-demo.xml,然后修改如下:
1. <?xml version="1.0" encoding="ISO-8859-1"?>
2. <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
3.
4. <Configure class="org.mortbay.jetty.webapp.WebAppContext">
5.
6. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
7. <!-- Required minimal context configuration : -->
8. <!-- + contextPath -->
9. <!-- + war OR resourceBase -->
10. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
看到开源项目发布的时候都带一个 jsp 容器(jetty)。拿来做 demo、开发、调试的服务器还是很不错的。今天就小试下,主要把它运行起来。
第一步下载:http://dist.codehaus.org/jetty/jetty-6.1.14/jetty-6.1.14.zip 是目前最新的稳定版。解压到如E:\jetty-6.1.14,其中比较重要的目录是:etc、contexts、webapps。个人认为可以类比 tomcat的conf、conf\Catalina\localhost、webapps目录。contexts是热部署用的。
试运行下,可以把一个简单的web项目到到webapps目录下,或是*.war,如:web-demo(或web-demo.war)放到webapps目录下。
E:\jetty-6.1.14>java -jar start.jar
2009-01-13 15:34:38.937::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2009-01-13 15:34:39.265::INFO: jetty-6.1.14
2009-01-13 15:34:39.421::INFO: Deploy E:\jetty-6.1.14\contexts\javadoc.xml -> org.mortbay.jetty.handler.ContextHandler@15cda3f{/javadoc,file:/E:/jetty-6.1.14/javadoc/}
...
2009-01-13 15:35:01.828::INFO: Opened E:\jetty-6.1.14\logs\2009_01_13.request.log
2009-01-13 15:35:01.953::INFO: Started SelectChannelConnector@127.0.0.1:8080
打开:http://localhost:8080/web-demo ,恩有结果了。
如果不把web-demo放到webapps目录下也可,在contexts目录下建立一个文件告诉jetty就行了。可以在contexts目录下复制test.xml为web-demo.xml,然后修改如下:
1. <?xml version="1.0" encoding="ISO-8859-1"?>
2. <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
3.
4. <Configure class="org.mortbay.jetty.webapp.WebAppContext">
5.
6. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
7. <!-- Required minimal context configuration : -->
8. <!-- + contextPath -->
9. <!-- + war OR resourceBase -->
10. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
11. <Set name="contextPath">/web-demo</Set>
12. <Set name="war">e:/workspace/web-demo/WebContent</Set>
13.
14. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
15. <!-- Optional context configuration -->
16. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
17. <Set name="extractWAR">false</Set>
18. <Set name="copyWebDir">false</Set>
19. <Set name="defaultsDescriptor">
20. <SystemProperty name="jetty.home" default="." />/etc/webdefault.xml</Set>
21. <!--
22. <Set name="overrideDescriptor"><SystemProperty name="jetty.home"
23. default="."/>/contexts/test.d/override-web.xml</Set>
24. -->
25. </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">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/web-demo</Set>
<Set name="war">e:/workspace/web-demo/WebContent</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
12. <Set name="war">e:/workspace/web-demo/WebContent</Set>
13.
14. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
15. <!-- Optional context configuration -->
16. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
17. <Set name="extractWAR">false</Set>
18. <Set name="copyWebDir">false</Set>
19. <Set name="defaultsDescriptor">
20. <SystemProperty name="jetty.home" default="." />/etc/webdefault.xml</Set>
21. <!--
22. <Set name="overrideDescriptor"><SystemProperty name="jetty.home"
23. default="."/>/contexts/test.d/override-web.xml</Set>
24. -->
25. </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">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/web-demo</Set>
<Set name="war">e:/workspace/web-demo/WebContent</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
剩余6页未读,继续阅读
资源评论
wangk_258
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Python的在线学习与推荐系统设计与实现(论文+源码)-kaic
- 蓝桥杯2024年第十五届省赛真题-前缀总分
- com.qihoo.appstore_300101305-1.apk
- tensorflow-gpu-2.7.1-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.2-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.1-cp39-cp39-manylinux2010-x86-64.whl
- 蓝桥杯2024年第十五届省赛真题-传送阵
- com.qihoo.appstore_300101305.apk
- linux之线程同步一.doc
- keil5配色方案10种
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功