posts - 122,  comments - 25,  trackbacks - 0
          Jetty 當前版本為6.1.x,支持servlet2.5、jsp 2.1/2.0。(http://docs.codehaus.org/display/JETTY)

          jetty主要的jar為jetty-6.1.1.jar,servlet-api-2.5-6.1.1.jar,jetty-util- 6.1.1.jar。啟動的jar 為start.jar。還有jsp規范的jar。jsp2.1,好像已經減了不少的jar了,只有4個文件core-3.1.1.jar,ant- 1.6.5.jar,jsp-2.1.jar,jsp-api-2.1.jar。core是使用eclipse的jdt,進行jsp編譯。

          jetty的主要配置文件為etc/jetty.xml,當然你可以自己指定別的文件。在start.jar中有個start.config文件是默認的環境配置,以及指定默認的配置文件。可以手工替換。

              啟動jetty很簡單,在命令行下面java -jar start.jar;如果需要指定start.config,使用java -DSTART=start.config -jar start.jart;配置web 應用也非常的簡單:更改jetty.xml就行了,增加web應用的方式包括,直接放置應用在webapps下面,或者配置以下的context

          配置Virtual hosts:
          <New class="org.mortbay.jetty.webapp.WebAppContext">
                
          <Arg><Ref id="contexts"/></Arg>
                
          <Arg><SystemProperty name="jetty.home">/webapps/xxx.war</Arg>
                
          <Arg>/xxx</Arg>
                
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                
          <Set name="VirtualHosts">
                  
          <Array type="java.lang.String">
                    <Item>127.0.0.1</Item>
                    
          <Item>www.sample.com</Item>
                    
          <Item>www.sample.net</Item>
                    
          <Item>www.sample.org</Item>
                  
          </Array>
                
          </Set>
          </New>

          context配置($JETTY-HOME/contexts/javadoc.xml):
          <Configure class="org.mortbay.jetty.servlet.Context">
            
          <Set name="contextPath">/javadoc</Set>
            
          <Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/javadoc/</Set>
            
          <Call name="addServlet">
              
          <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
              
          <Arg>/</Arg>
            
          </Call>
          </Configure>


          默認webapp目錄配置:
          <Call name="addLifeCycle">
            
          <Arg>
              
          <New class="org.mortbay.jetty.deployer.WebAppDeployer">
                
          <Set name="contexts"><Ref id="Contexts"/></Set>
                
          <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
                
          <Set name="parentLoaderPriority">false</Set>
                
          <Set name="extract">true</Set>
                
          <Set name="allowDuplicates">false</Set>
                
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
              
          </New>
            
          </Arg>
          </Call>


          默認的web.xml配置文件為webdefault.xml,如果想配置相應的web參數,可以更改其應用。默認的端口為8080,如果想修改,更改:jetty.port屬性
              <Call name="addConnector">
                
          <Arg>
                    
          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
                      
          <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
                      
          <Set name="maxIdleTime">30000</Set>
                      
          <Set name="Acceptors">2</Set>
                      
          <Set name="confidentialPort">8443</Set>
                    
          </New>
                
          </Arg>
              
          </Call>

          更詳細的配置信息可查詢官網。
          posted on 2008-01-03 13:51 josson 閱讀(1878) 評論(0)  編輯  收藏 所屬分類: java 開發
          <2008年1月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 西林县| 陕西省| 锦屏县| 开化县| 永福县| 娄底市| 通渭县| 宜良县| 叶城县| 铜鼓县| 崇文区| 醴陵市| 阿克陶县| 开封县| 志丹县| 河津市| 静安区| 隆安县| 巴塘县| 甘德县| 合水县| 汽车| 伊金霍洛旗| 襄汾县| 东宁县| 新乐市| 阜城县| 且末县| 仪陇县| 揭阳市| 齐河县| 土默特右旗| 宜都市| 灵寿县| 万山特区| 石首市| 永兴县| 荆门市| 建德市| 象山县| 宜兰市|