`

jetty嵌入式采用xml配置

阅读更多
	Server server = new Server();
	XmlConfiguration configuration = null;
	InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("jetty.xml");
	configuration = new XmlConfiguration(in);
	configuration.configure(server);
	server.start();	
	server.join();

 

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<!-- =============================================================== -->
<!-- Configure the Jetty Server                                      -->
<!--                                                                 -->
<!-- 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.  For example:                              -->
<!--   java -jar start.jar etc/jetty-ssl.xml                         -->
<!--                                                                 -->
<!-- See start.ini file for the default configuraton files           -->
<!-- =============================================================== -->


<Configure id="Server" class="org.eclipse.jetty.server.Server">

    <!-- =========================================================== -->
    <!-- Server Thread Pool                                          -->
    <!-- =========================================================== -->
    <Set name="ThreadPool">
      <!-- Default queued blocking threadpool -->
      <New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
        <Set name="minThreads">20</Set>
        <Set name="maxThreads">1000</Set>
        <Set name="detailedDump">false</Set>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- Set connectors                                              -->
    <!-- =========================================================== -->

    <Call name="addConnector">
      <Arg>
          <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
            <Set name="host"><Property name="jetty.host" /></Set>
            <Set name="port"><Property name="jetty.port" default="8004"/></Set>
            <Set name="maxIdleTime">300000</Set>
            <Set name="Acceptors">10</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8448</Set>
	    	<Set name="lowResourcesConnections">20000</Set>
	    	<Set name="lowResourcesMaxIdleTime">5000</Set>
          </New>
      </Arg>
    </Call>
	
    <!-- =========================================================== -->
    <!-- Set handler Collection Structure                            --> 
    <!-- =========================================================== -->
    <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="WebAppContext" class="org.eclipse.jetty.webapp.WebAppContext"><Arg>web</Arg><Arg>/</Arg></New>
           </Item>
         </Array>
        </Set>
      </New>
    </Set>

    <!-- =========================================================== -->
    <!-- extra options                                               -->
    <!-- =========================================================== -->
    <Set name="stopAtShutdown">true</Set>
    <Set name="sendServerVersion">true</Set>
    <Set name="sendDateHeader">true</Set>
    <Set name="gracefulShutdown">1000</Set>
    <Set name="dumpAfterStart">false</Set>
    <Set name="dumpBeforeStop">false</Set>
    
</Configure>

 

分享到:
评论

相关推荐

    jetty嵌入式服务器实例大全

    java jetty嵌入式服务器实例大全,包括文件资源、servlet、xml配置服务器、war包、多端口监听等实例。

    jetty嵌入式web容器jar包

    jetty嵌入式web容器jar包 示例: public static void main(String[] args) { // 服务器的监听端口 Server server = new Server(6666); // 关联一个已经存在的上下文 WebAppContext context = new WebAppContext...

    使用Jetty嵌入式开发调试Web程序

    NULL 博文链接:https://yangq.iteye.com/blog/1399621

    jetty-5.1.12

     易用性是 Jetty 设计的基本原则,易用性主要体现在以下几个方面: 通过 XML 或者 API 来对 Jetty 进行配置;默认配置可以满足大部分的需求;将 Jetty 嵌入到应用程序当中只需要非常少的代码; 可扩展性 在使用了 ...

    springboot-demo-helloworld-jetty.rar

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

    spring-jetty-example:Spring MVC 4示例应用程序

    Spring MVC嵌入式码头示例 使用嵌入式Jetty 9服务器的基本Spring MVC 4应用程序。 无xml配置。 包括API REST服务,Freemarker和JSP示例。 与Mongo DB集成。 要求

    spring-boot-hibernate:最初的

    使用Spring Boot无需任何XML文件的Spring Web MVC(+ Hibernate,Spring Data JPA)问候世界在此示例中,没有web.xml,没有Spring xml配置文件,没有persistence.xml,没有* .hbm.xml,只是没有XML配置文件,该文件...

    lift-jquery-module_2-6_2.10-2.7.zip

    embedded-jetty.zip,用于启动嵌入式Jetty的代码。提供了一种简单的方法来构建允许无XML应用程序的嵌入式Jetty

    spring-no-xml

    这是一个演示没有xml的spring web应用程序的项目。 在目标目录中创建了一个战争。 与 dropwizard 一样,Jax-rs 注释用于 mvc 框架。 在resources/app.properties有一个属性占位符只是为了演示这一点。 有一个码头...

    helloworld_war_ant:带有构建的Ant示例

    Helloworld Servlet(使用注释) 静态html文件示例最基本的web.xml 编译时servlet-api.jar(因此不需要Java EE) 用于构建WAR的Ant build.xml 使用slf4j-api和sl4j-simple进行简单日志记录Jetty嵌入式服务器可直接...

    jetpack:jet.pack:将您的JRuby机架应用打包为Jetty

    喷气背包: 在所有现成的XML配置文件荣耀中使用 ...。 使用捆绑器“出售”您所有的宝石。 使用 ,并在您的项目中提供方便的包装脚本( bin/ruby和bin/rake )。 不要尝试以Ruby优先的嵌入式方式运行Jetty。 不要...

    springboot简单总结

    springboot学习路程中有关的资料,创建独立Spring应用程序,嵌入式Tomcat,Jetty容器,无需部署WAR包,简化Maven及Gradle配置,尽可能的自动化配置Spring,直接植入产品环境下的实用功能,...无需代码生成及XML配置。

    jetty-cloud:用于Cloudfoundry部署的示例嵌入式码头项目

    码头云图像示例项目 这是Jetty Web服务器的示例项目,该项目... 您可以在App类中自定义Web服务器,该类类似于码头发行版中的start.xml文件。 推送命令示例: cf push appname -p jetty-cloud-xyzjar -b java_buildpack

    spring-vaadin-login-crud

    但是,您可以选择使用嵌入式Web服务器部署来代替Tomcat,例如Jetty(HTTP(Web)服务器和Java Servlet容器)或Java EE Application Server。 您必须在pom.xml中将这些替换配置为默认替换为新替换正在安装只需克隆...

    herokujavarestfull

    嵌入式 Jetty 模板应用这是使用嵌入式 Jetty 的 Web 应用程序的模板。 示例代码由一个 JSP(这个页面)和一个简单的 servlet 组成。JAX-RS 模板应用程序这是使用 JAX-RS 的轻量级 RESTful API 的模板。 示例代码是...

    matlab改变代码字体-invesdwin-context:软件产品线的模块系统

    测试还得益于灵活的方法,即可以用存根替换Bean实例,根据情况选择要加载的不同spring-xmls并可以通过注释在每个测试的基础上启用嵌入式服务器(例如,webserver = jetty,database = h2)。 这些嵌入式服务器本身...

    war-executor:一个 maven 插件,用于创建带有战争、嵌入式服务器和运行它的脚本的 zip 文件

    war-executor 是一个 maven 插件,它使部署 war 和启动 Web 服务器(现在是 Jetty)就像运行脚本一样简单。 它有助于以 zip 格式(目前支持)分发带有嵌入式服务器的战争 如何使用war-executor插件: 通过在 pom....

    skladGre:营地仓库管理应用

    斯克拉德格雷 营地仓库管理应用程序...仍在开发中。 ... 没有 XML 文件!!! 该项目包含一个“嵌入式 HSQL 数据库”,每次重新启动时都会对其... 启动应用程序: mvn jetty: run (或: clean package jetty: run) ... at

    LeetCode字符串换行-rhythmdiao-java-base:个人开发和使用的轻量开发框架

    嵌入式jetty服务器以及daemon模式构建应用程序 provides annotated handlers to demonstrate simple restful like API, handler switch Restful风格自定义接口,注解方式注射请求参数,接口降级开关 wrapped json ...

    sso:单点登录系统

    log4j2.xml 建造 mvnw clean package 或者 mvnw.bat clean package 部署方式 嵌入式码头 使用密码changeit在/etc/cas/jetty/thekeystore创建Java密钥库。 将您的CAS服务器证书导入此密钥库中。 mvnw jetty:run-...

Global site tag (gtag.js) - Google Analytics