`

jetty入门配置

阅读更多

1、下载:下http://dist.codehaus.org/jetty   解压到如E:\jetty-6.1.14,其中比较重要的目录是:etc、contexts、webapps。个人认为可以类比tomcat的conf、conf\Catalina\localhost、webapps目录。contexts是热部署用的。

试运行下,可以把一个简单的web项目到到webapps目录下,或是*.war,如:web-demo(或web-demo.war)放到webapps目录下。进入jetty目录运行 java -jar start.jar 启动jetty服务器

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 ,恩有结果了。

2、如果不把web-demo放到webapps目录下也可,在contexts目录下建立一个文件告诉jetty就行了。可以在contexts目录下复制test.xml为web-demo.xml,然后修改如下:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<!-- ==================================================================
Configure and deploy the test web application in $(jetty.home)/webapps/test

Note. If this file did not exist or used a context path other that /test
then the default configuration of jetty.xml would discover the test
webapplication with a WebAppDeployer.  By specifying a context in this
directory, additional configuration may be specified and hot deployments 
detected.
===================================================================== -->

<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>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Optional context configuration                                  -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Set name="extractWAR">false</Set>
  <Set name="copyWebDir">false</Set>
  <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
</Configure>
分享到:
评论
3 楼 smallbee 2012-07-17  
不知道您有没有试过,请问下您这里的配置
<Set name="contextPath">/web_demo</Set> 

只是设置上下文的名称么?然后应用web_demo的路径是由<Set name="war">e:/workspace/web-demo/WebContent</Set> 
决定的,是这个意思么?
2 楼 pzxsheng 2012-02-21  
按照你的方法 ,我怎么访问不了了
1 楼 cumtlu 2011-10-21  
 

相关推荐

    jetty快速入门与嵌入使用

    jetty快速入门与嵌入使用,简单、易懂,轻松学习!

    Jetty中文手册

    Jetty入门(视频) 下载和安装Jetty 如何安装一个Jetty包 如何配置Jetty – 主要文档 如何运行Jetty 用JConsole监控Jetty 如何使用Jetty开发 Jetty HelloWorld教程 Jetty和Maven HelloWorld教程 Jetty(6)入门 ...

    maven&struts2&jetty&tomcat

    该包适用于maven新手入门,因为作者本身也是一员maven新手,里面包括了maven的下载包,插件包,插件的配置,环境变量的设置,maven项目建立的详解及运行,里面集成了jetty,tomcat,struts2,当然还包括了直接运行jar包...

    springmvn搭建的Maven项目入门

    本项目是SpringMVC框架入门配置 IDEA下搭建Maven项目,配置jetty服务,代码简单、完整。可以运行,做完入门的学习

    maven的入门使用

    maven入门使用 maven创建web项目 maven生成eclipse项目 maven+jetty的使用 jetty在eclipse的配置和使用

    springboot-demo-helloworld-jetty.rar

    # SpringBoot的特点为基于Spring的开发提供更快的入门体验开箱即用,没有代码生成,也无需XML配置。同时也可以修改默认值来满足特定的需求提供了一些大型项目中常见的非功能性特性,如嵌入式服务器、安全、指标,...

    guice-jersey:Guice模块,用于使用Jersey启动基于Jetty的休息服务器

    该模块旨在通过启动基于Jetty的Jersey服务器并初始化HK2与Guice之间的桥接来实现此目的。 安装 Gradle compile ' io.logz:guice-jersey:1.0.13 ' 玛文 &lt; groupId&gt;io.logz &lt; artifactId&gt;guice-jersey &lt; version&gt;...

    solr_nginx:Solr 的入门反向代理配置

    为什么不只是在示例中使用 Jetty 配置? 或者部署到Tomcat什么的? Solr 使用 Jetty 进行了最彻底的测试。 具体来说,Jetty 与 Solr 捆绑在“example”目录中。 在 OpenSource Connections,我们经常需要帮助客户...

    openshift-sonatype-nexus-jetty:Openshift Sonatype Nexus DIY 墨盒

    构建挂钩将自动下载和配置 Sonatype Nexus Jetty 包分发。 启动挂钩脚本是运行此应用程序所需的唯一自定义代码。 快速入门:从 GitHub 部署 在 Openshift 应用程序选项卡下,单击立即Create your first application...

    GeoServer开发手册系列

    配置Jetty的JNDI资源 19 Eclipse首选项 20 代码格式化 21 代码模板 22 文本编辑器 22 编译器 23 OWS服务 24 OWS服务概览 24 实现一个简单的OWS服务 24 建立 25 创建插件 27 试一试 30 REST服务 34 简介 34 RESTful...

    java后端源码-dwb:Dojo1-DojoWebBuilder

    插件以最少的配置配置为快速启动,请参阅下面的详细信息。 要连接应用程序,在运行后,将 Web 浏览器指向 。 此外,该应用程序不依赖于这些平台,允许您构建 WAR 文件并部署到您选择的应用程序服务器。 Jetty 快速...

    spring5-hibernate5-with-spring-security

    系统要求构建该项目所需的全部是: Java 8 Maven 3.5.3, Wildfly 11或Jetty 9.4.9.v20180320, MySQL 或 该项目生成的应用程序旨在在JBoss WildFly和Jetty上运行。与JBoss合作1.配置Maven 如果尚未这样做,则必须在...

    轻量级JavaWeb框架Fast-FrameWork.zip

    零配置 REST 服务接口 基于 JSON 传输 目前提供 MVC ... 解决方案 作者与学习乐园 源码地址:我的GitHub地址 作者: 李强强 也叫 泥瓦匠 快速入门 1. 必备...

    documentation:fis用户手册

    url加域名压缩、校验、测试、打包指定项目根目录或项目配置文件文件监听与浏览器自动刷新缓存清除与单机多人编译输出冗余信息fis server &lt;command&gt; [options]启动nodejs服务器启动jetty服务器启动php服务器fis ...

    springboot参考指南

    配置Jetty xi. 64.11. 使用Undertow替代Tomcat xii. 64.12. 配置Undertow xiii. 64.13. 启用Undertow的多监听器 xiv. 64.14. 使用Tomcat7 i. 64.14.1. 通过Maven使用Tomcat7 ii. 64.14.2. 通过Gradle使用Tomcat7 xv...

    Grails1.1中文文档

    一个内嵌的 Jetty 容器被配置用来快速重载应用 Spring 容器内建的依赖注入技术 基于 Spring 的 MessageSource 核心概念的国际化 (i18n) 支持 基于 Spring 的抽象事务概念的事务服务层 所有这些都非常易于使用,...

    SpringBootStarter:模板Spring Boot项目演示了使用Spring Security保护的REST服务

    使用Gradle的Spring Boot入门项目 该项目旨在通过可用于部署的REST服务使您尽快启动并运行。 它使用以下技术: Java Sprint Boot Gradle 它演示了以下内容: 服务,域对象和测试客户端的单独项目 端到端单元测试 ...

    spring-vaadin-login-crud

    简单的VAADIN-Spring启动项目入门基础设施Java 8玛文Spring-Boot和其他依赖项(data-jpa,测试)瓦丹H2内存数据库先决条件只需运行SampleVaadinApplication.java .Spring Boot具有一个嵌入式Tomcat实例。 Spring ...

    演示2

    它是学习入门的快速阅读,而不是有关如何设计应用程序的示例。 请注意,此示例使用并要求Java 8才能运行。 从命令行运行示例 $ mvn jetty:run 打开 在IntelliJ IDEA 14中导入 这些说明已在IntelliJ IDEA 14 CE上...

Global site tag (gtag.js) - Google Analytics