zoukankan      html  css  js  c++  java
  • Deploying a web application to Jetty

    Deploying a web application to Jetty « Enavigo

    Deploying a web application to Jetty

    The Jetty web application server is great. It is just not very well document and when it is documented it is aimed for the very uninitiated. If you’re using Jetty, it is almost like an old boys club – ‘you made it’.

    Still, it appears that Jetty and Tomcat are becoming much more similar in their way of doing things, with both using a somewhat proprietary, if you can say that on an open source project, configuration schemes. So how do you deploy a web application to Jetty?

     

    1. Create a WAR file for your application. This is standard and I assume you already know how to do this with Ant or inside of Eclispe (if you are truly lazy and I am often very lazy). Like any WAR file it will contain a deployment descriptor – web.xml – which will specify information about filters, servlets, jsp files and other standard configuration options.
    2. Like Tomcat, Jetty can use a context file to specify the server-specific configuration of the web application. In Jetty, context files live in the aptly named contexts folder. Each context file looks something like this (example taken from Jetty’s documentation):
      1
      2
      3
      4
      5
      6
      
      < ?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">
        <set name="contextPath">/test</set>
        <set name="war"><systemproperty name="jetty.home" default="."/>/webapps/test.war</set>
      </configure>

      In this case, the contextPath element specifies the context by which users will find the application on your server; in this case http://[domain-name]/test/. The war element represents the location of the WAR file. Here, it is inside the Jetty home directory, under the standard webapps folder, using a WAR file called test.war. If your WAR file is exploded, just put the name of the folder under which the files reside.

    3. Save the context file with the same name as your web application WAR file inside the contexts directory.
    4. Put your WAR file in the location referenced in the context file (e.g. $JETTY_HOME/webapps/test.war)
    5. Start Jetty from the command line by calling

      java -jar start.jar

      when in the home Jetty directory.

    I used Jetty 6.1.7 to verify the code.

    In short, this is really easy.

  • 相关阅读:
    结婚很难
    ***归心似箭***
    听首你家健和我家菲都唱过的歌吧
    努力幸福
    080509
    快速切题 poj1573
    POJ 2586 Y2K Accounting Bug 贪心 难度:2
    快速切题 poj2632
    POJ 3579 median 二分搜索,中位数 难度:3
    HDU 4802 && HDU 4803 贪心,高精 && HDU 4804 轮廓线dp && HDU 4805 计算几何 && HDU 4811 (13南京区域赛现场赛 题目重演A,B,C,D,J)
  • 原文地址:https://www.cnblogs.com/lexus/p/2397128.html
Copyright © 2011-2022 走看看