转载自http://www.cnblogs.com/nightswatch/p/4639687.html的博文

eclipse中安装jetty插件并使用

 

一.eclipse中jetty插件安装:

  打开eclipse,依次点击菜单Help->Eclipse Marketplace,在Find后面的框中输入jetty,选择第一项进行install即可。

  

二.jetty插件的使用:

安装成功后可能要重启eclipse: 
然后开始配置: 
Run》run configurations》 
在Jetty Webapp》右键》new,Browser想要启动的项目,配置端口号(我配的是8080),Arguments需要指向一个jetty.xml文件(这个文件可以从jetty网站上下载到,下面我也会贴出来)

上面的jetty.xml文件如下: 

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- =============================================================== -->
<!-- Documentation of this file format can be found at: -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
<!-- -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
<!-- and can be mixed in. See start.ini file for the default -->
<!-- configuration files. -->
<!-- -->
<!-- For a description of the configuration mechanism, see the -->
<!-- output of: -->
<!-- java -jar start.jar -? -->
<!-- =============================================================== --> <!-- =============================================================== -->
<!-- Configure a Jetty Server instance with an ID "Server" -->
<!-- Other configuration files may also configure the "Server" -->
<!-- ID, in which case they are adding configuration to the same -->
<!-- instance. If other configuration have a different ID, they -->
<!-- will create and configure another instance of Jetty. -->
<!-- Consult the javadoc of o.e.j.server.Server for all -->
<!-- configuration that may be set here. -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <!-- =========================================================== -->
<!-- Configure the Server Thread Pool. -->
<!-- The server holds a common thread pool which is used by -->
<!-- default as the executor used by all connectors and servlet -->
<!-- dispatches. -->
<!-- -->
<!-- Configuring a fixed thread pool is vital to controlling the -->
<!-- maximal memory footprint of the server and is a key tuning -->
<!-- parameter for tuning. In an application that rarely blocks -->
<!-- then maximal threads may be close to the number of 5*CPUs. -->
<!-- In an application that frequently blocks, then maximal -->
<!-- threads should be set as high as possible given the memory -->
<!-- available. -->
<!-- -->
<!-- Consult the javadoc of o.e.j.util.thread.QueuedThreadPool -->
<!-- for all configuration that may be set here. -->
<!-- =========================================================== -->
<Arg name="threadpool">
<New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Arg name="minThreads" type="int">10</Arg>
<Arg name="maxThreads" type="int">200</Arg>
<Arg name="idleTimeout" type="int">60000</Arg>
<Set name="detailedDump">false</Set>
</New>
</Arg> <!-- =========================================================== -->
<!-- Add shared Scheduler instance -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.thread.ScheduledExecutorScheduler"/>
</Arg>
</Call> <!-- =========================================================== -->
<!-- Http Configuration. -->
<!-- This is a common configuration instance used by all -->
<!-- connectors that can carry HTTP semantics (HTTP, HTTPS, SPDY)-->
<!-- It configures the non wire protocol aspects of the HTTP -->
<!-- semantic. -->
<!-- -->
<!-- This configuration is only defined here and is used by -->
<!-- reference from the jetty-http.xml, jetty-https.xml and -->
<!-- jetty-spdy.xml configuration files which instantiate the -->
<!-- connectors. -->
<!-- -->
<!-- Consult the javadoc of o.e.j.server.HttpConfiguration -->
<!-- for all configuration that may be set here. -->
<!-- =========================================================== -->
<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> <Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="4001" />4001</Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call> <!-- =========================================================== -->
<!-- Set the default handler structure for the Server -->
<!-- A handler collection is used to pass received requests to -->
<!-- both the ContextHandlerCollection, which selects the next -->
<!-- handler by context path and virtual host, and the -->
<!-- DefaultHandler, which handles any requests not handled by -->
<!-- the context handlers. -->
<!-- Other handlers may be added to the "Handlers" collection, -->
<!-- for example the jetty-requestlog.xml file adds the -->
<!-- RequestLogHandler after the default 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> <!-- =========================================================== -->
<!-- extra server options -->
<!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set>
<Set name="stopTimeout">5000</Set>
<Set name="dumpAfterStart">false</Set>
<Set name="dumpBeforeStop">false</Set> </Configure>

请注意更改端口号

之后Apply,run,即可快速启动该项目。 
通过:http://localhost:8080/demo2/即可访问工程 
上述模式,仅是运行模式,还不能debug。 
debug与上面唯一的不同就是要由: 
Run》debug configurations》进入配置,其它完全一样,启动后,即可设置断点进行配置。 
----------------- 
若想通过maven来启动jetty,见我的上一篇文章:

http://www.cnblogs.com/nightswatch/p/4639664.html

eclips如何安装jetty插件的更多相关文章

  1. Eclipse安装Jetty插件

    通过Eclipse MarketPlace安装Jetty插件. Jetty下载 1.  2.3.4.5. 注:在使用Jetty的时候,同一个Project中,不可以同时存在两个版本的库,否则会出现找不 ...

  2. eclpse安装jetty插件

    公司不用tomcat,使用的是jetty,那么学习一下如何在eclipse中安装jetty插件.

  3. 如何在Eclipse中正确安装Jetty插件并初步使用(图文详解)

    不多说,直接上干货! 最近在做一个Storm项目,需要用到Jetty来进行展示.它类似于Tomcat. 一.eclipse中jetty插件安装 打开eclipse,依次点击菜单Help->Ecl ...

  4. Eclipse安装Jetty插件(Web容器)

    Eclipse除了安装Tomcat插件外,还可以安装Jetty,相对来说Jetty比Tomcat配置简单. Tomcat安装及配置:http://www.cnblogs.com/EasonJim/p/ ...

  5. eclipse中安装jetty插件并使用

    一.eclipse中jetty插件安装: 打开eclipse,依次点击菜单Help->Eclipse Marketplace,在Find后面的框中输入jetty,选择第一项进行install即可 ...

  6. eclipse jetty插件安装(离线版)

    按照网上的说法安装jetty插件,run-jetty-run,google那个网址根本链接不上.所以插件装不上,网上搜索本地版,试了几个都不好使,功能不全,这是因为下载的本地资源jar包不全导致,好坑 ...

  7. (转)eclipse安装jetty

    背景:在项目开发的过程中,一个老的项目使用的是jetty启动,在用tomcat启动的过程中出现了启动不了的异常,浪费了好多时间.因为项目一直是用jetty启动的,为了不浪费时间,也只好改变思路选择je ...

  8. Jetty入门(1-2)eclipse集成jetty插件并发布运行应用

    一.eclipse集成jetty插件 1.从市场安装jetty插件 2.使用jetty插件发布应用和配置运行环境 debug配置默认共用上述run配置 3.使用jetty插件启动运行和停止运行选中的应 ...

  9. Eclipse Jetty插件安装

    Eclipse Jetty插件安装 使用方法一: 本地资源包插件下载地址:http://pan.baidu.com/s/1sjNP5Id 或者是地址:http://pan.baidu.com/s/1b ...

随机推荐

  1. PyQt(Python+Qt)学习随笔:desktop的宽带、高度widthMM、heightMM

    通过desktop获取桌面的高度和宽度,代码如下: desktop = app.desktop() srceenSize = desktop.width(),desktop.height() srce ...

  2. [BJDCTF 2nd]duangShell

    [BJDCTF 2nd]duangShell 点击进去之后提示我们swp源代码泄露,访问http://xxx/.index.php.swp下载该文件 该文件产生的原因是:​使用vi编辑器打开文件时,会 ...

  3. XFF SSTI 模板注入 [BJDCTF2020]The mystery of ip

    转自https://www.cnblogs.com/wangtanzhi/p/12328083.html SSTI模板注入:之前也写过:https://www.cnblogs.com/wangtanz ...

  4. swagger添加统一认证参数

    import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Co ...

  5. [Java复习]架构部署 超时重试 幂等防重

    画一下你们系统的整体架构图,说说各个服务在生产环境怎么部署的? 核心:服务框架.注册中心.网关 即使你没有用很多微服务架构里的东西,只要有上述三个东西,配合上写一些文档,接口文档,分布式系统架构,其实 ...

  6. 【题解】Generator(UVA1358)

    感觉我字符串和期望都不好-- 题目链接 题意 有 \(n\) 种字符,给定一个模式串 \(S\) ,一开始字符串为空,现在每次随机生成一个 1~n 的字符添加到字符串末尾,直到出现 \(S\) 停止, ...

  7. eclipse 搭建连接 activemq

    今天我特地写下笔记,希望可以完全掌握这个东西,也希望可以帮助到任何想对学习这个东西的同学. 1.下载activemq压缩包,并解压(如果需要下载请看文章尾部附录) 2.进入bin文件夹,(64位电脑就 ...

  8. OpenShift添加应用健康检查功能

    什么是健康检查? 对于部署成功的应用来说,通过访问接口.执行特定命令等方式判断应用是否存活.正常的方式称为健康检查. 在 OpenShift 或 Kubernetes 中,健康检查都有两个探针,分别是 ...

  9. centos7安装zabbix server5.0

    安装zabbix源 1.rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarc ...

  10. Flink读写Redis(一)-写入Redis

    项目pom文件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w ...