初步认识jetty,以及在项目中,如何结合jetty进行调试

来源:互联网 发布:墨灿游戏 知乎 编辑:程序博客网 时间:2024/06/05 06:42

JETTY介绍

jetty7以后,已经归属为eclipse旗下的产品,其网站主页为: http://wiki.eclipse.org/Jetty/

jetty是一个比tomcat更轻便灵活的web容器,我们可以利用jetty 结合eclipse来调试webapp


JETTY文档阅读

http://wiki.eclipse.org/Jetty 这里面详细描叙了jetty的方方面面,比如几个重要的方面:

1. 嵌入式样Embedding Jetty

    jetty除开可以像tomcat一样独立运行,更可以嵌入到程序内部作为sdk调用方式运行,Jetty有一句名言:Don't deploy your application in Jetty, deploy Jetty in your application

2. jetty也可以通过run-jetty-run这个eclipse插件来嵌入eclipse运行


使用maven引入jietty

wiki里面的文章:Build/IDE Integration里面的Using Jetty with Eclipse详细介绍了如何引入jetty的dependy,做法如下:

   <!-- TODO 1 Pick the version of jetty you want. -->   <properties>       <jetty.version>7.1.6.v20100715</jetty.version>   </properties>   <!-- TODO 2 Configure repo2.maven.org as a repository. -->   <repositories>       <repository>           <id>repo2_maven_org</id>           <url>http://repo2.maven.org/maven2</url>       </repository>   </repositories>       <!-- TODO 3 Set up dependency to get the jetty-server artifact. -->   <dependencies>       <dependency>           <groupId>org.eclipse.jetty</groupId>           <artifactId>jetty-server</artifactId>           <version>${jetty.version}</version>       </dependency>   </dependencies>

原创粉丝点击