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 閱讀(1882) 評論(0)  編輯  收藏 所屬分類: java 開發
          <2008年1月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 迭部县| 东海县| 车致| 新源县| 开阳县| 冷水江市| 浦江县| 南康市| 永兴县| 彭山县| 孟连| 南汇区| 英德市| 浦县| 丹棱县| 枝江市| 仁化县| 江西省| 宜城市| 修水县| 辉南县| 墨竹工卡县| 靖江市| 中宁县| 新和县| 武义县| 固原市| 韶山市| 阿鲁科尔沁旗| 安新县| 文登市| 泾源县| 林西县| 安顺市| 关岭| 招远市| 衡山县| 醴陵市| 大英县| 屯昌县| 九龙坡区|