<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-124  評(píng)論-194  文章-0  trackbacks-0

    之前文章提到過用MAVEN2啟動(dòng)JETTY,這里介紹一種直接從ECLIPSE中啟動(dòng)的辦法。
     
    適用于6.1.3以上,包括6.1.5的JETTY。

    它主要是利用了JDK的代碼自動(dòng)更換性能(code hot replace),可以不用重啟JETTY就調(diào)試、更換資源文件。注意:一定是DEBUG方式運(yùn)行才有這項(xiàng)功能。

    所以應(yīng)該說這篇文章的方法更好:

    在Run->Debug中,New一個(gè)Java Application的配置,填入:

    org.mortbay.xml.XmlConfiguration

    參數(shù)填入一個(gè)自己的JETTY配置文件:




    完成的myjetty.xml配置文件,請(qǐng)將其中的相應(yīng)目錄修改成自己項(xiàng)目的目錄:

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

    <!-- =============================================================== -->
    <!-- Configure the Jetty Server                                      -->
    <!--                                                                 -->
    <!-- Documentation of this file format can be found at:              -->
    <!-- http://docs.codehaus.org/display/JETTY/jetty.xml                -->
    <!--                                                                 -->
    <!-- =============================================================== -->


    <Configure id="Server" class="org.mortbay.jetty.Server">

        
    <!-- =========================================================== -->
        
    <!-- Server Thread Pool                                          -->
        
    <!-- =========================================================== -->
        
    <Set name="ThreadPool">
          
    <!-- Default bounded blocking threadpool 
          
    -->
          
    <New class="org.mortbay.thread.BoundedThreadPool">
            
    <Set name="minThreads">10</Set>
            
    <Set name="maxThreads">250</Set>
            
    <Set name="lowThreads">25</Set>
          
    </New>

          
    <!-- Optional Java 5 bounded threadpool with job queue 
          <New class="org.mortbay.thread.concurrent.ThreadPool">
            <Set name="corePoolSize">250</Set>
            <Set name="maximumPoolSize">250</Set>
          </New>
          
    -->
        
    </Set>



        
    <!-- =========================================================== -->
        
    <!-- Set connectors                                              -->
        
    <!-- =========================================================== -->
        
    <!-- One of each type!                                           -->
        
    <!-- =========================================================== -->

        
    <!-- Use this connector for many frequently idle connections
             and for threadless continuations.
        
    -->    
        
    <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="statsOn">false</Set>
                
    <Set name="confidentialPort">8443</Set>
            
    <Set name="lowResourcesConnections">5000</Set>
            
    <Set name="lowResourcesMaxIdleTime">5000</Set>
              
    </New>
          
    </Arg>
        
    </Call>

        
    <!-- Use this connector if NIO is not available.
        <Call name="addConnector">
          <Arg>
              <New class="org.mortbay.jetty.bio.SocketConnector">
                <Set name="port">8081</Set>
                <Set name="maxIdleTime">50000</Set>
                <Set name="lowResourceMaxIdleTime">1500</Set>
              </New>
          </Arg>
        </Call>
        
    -->

        
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        
    <!-- To add a HTTPS SSL listener                                     -->
        
    <!-- see jetty-ssl.xml to add an ssl connector. use                  -->
        
    <!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml             -->
        
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        
        
    <!-- =========================================================== -->
        
    <!-- Set up global session ID manager                            -->
        
    <!-- =========================================================== -->
        
    <!--
        <Set name="sessionIdManager">
          <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
            <Set name="workerName">node1</Set>
          </New>
        </Set>
        
    -->

        
    <!-- =========================================================== -->
        
    <!-- Set handler Collection Structure                            --> 
        
    <!-- =========================================================== -->
        
    <Set name="handler">
          
    <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
            
    <Set name="handlers">
             
    <Array type="org.mortbay.jetty.Handler">
               
    <Item>
                 
    <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
               
    </Item>
               
    <Item>
                 
    <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
               
    </Item>
               
    <Item>
                 
    <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
               
    </Item>
             
    </Array>
            
    </Set>
          
    </New>
        
    </Set>
        
    <Set name="handler">   
      
    <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">   
        
    <Set name="handlers">   
          
    <Array type="org.mortbay.jetty.Handler">   
            
    <!--Item>   
              <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>   
            </Item
    -->   
            
    <Item>   
              
    <New class="org.mortbay.jetty.webapp.WebAppContext">   
                
    <Set name="contextPath">/ebnms</Set>   
                
    <Set name="resourceBase">E:/Prj2/ForMe/Src/flower/src/main/webapp</Set>   
                
    <Call name="addServlet">   
                  
    <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>   
                  
    <Arg>/</Arg>   
                
    </Call>   
              
    </New>   
        
    </Item>   
          
    </Array>   
        
    </Set>   
      
    </New>   
    </Set>   


        
    <!-- =========================================================== -->
        
    <!-- Configure Authentication Realms                             -->
        
    <!-- Realms may be configured for the entire server here, or     -->
        
    <!-- they can be configured for a specific web app in a context  -->
        
    <!-- configuration (see $(jetty.home)/contexts/test.xml for an   -->
        
    <!-- example).                                                   -->
        
    <!-- =========================================================== -->
        
    <Set name="UserRealms">
          
    <Array type="org.mortbay.jetty.security.UserRealm">
            
    <!--
            <Item>
              <New class="org.mortbay.jetty.security.HashUserRealm">
                <Set name="name">Test Realm</Set>
                <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
              </New>
            </Item>
        
    -->
          
    </Array>
        
    </Set>

        
    <!-- =========================================================== -->
        
    <!-- Configure Request Log                                       -->
        
    <!-- Request logs  may be configured for the entire server here, -->
        
    <!-- or they can be configured for a specific web app in a       -->
        
    <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
        
    <!-- for an example).                                            -->
        
    <!-- =========================================================== -->
        
    <!--Ref id="RequestLog">
          <Set name="requestLog">
            <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
              <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
              <Set name="filenameDateFormat">yyyy_MM_dd</Set>
              <Set name="retainDays">90</Set>
              <Set name="append">true</Set>
              <Set name="extended">true</Set>
              <Set name="logCookies">false</Set>
              <Set name="LogTimeZone">GMT</Set>
            </New>
          </Set>
        </Ref
    -->

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

    posted on 2007-09-13 21:04 我愛佳娃 閱讀(19672) 評(píng)論(8)  編輯  收藏 所屬分類: 服務(wù)配置

    評(píng)論:
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式 2007-09-16 13:56 | shiqiang124@gmail.com
    可以再詳細(xì)點(diǎn)嗎?
    是不是在多個(gè)

    <modules>
    <module>core</module>
    <module>web</module>
    </modules>
    也可以這種方式?  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式[未登錄] 2007-09-16 14:21 | 我愛佳娃
    沒明白你的意思呀?我就是這樣在ECLIPSE中配置的,調(diào)試和動(dòng)態(tài)代碼替換都沒問題。沒有多加什么配置。好像這也不是JETTY的配置指令呀?  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式 2007-09-30 11:27 | 草鞋超人
    Jetty的XML configuration 實(shí)在是太暈了,官網(wǎng)的文檔里也說得語焉不詳。難道真的要讓人去看code嗎?還是逼人買他的Consultant 服務(wù)啊……

    這里想提一個(gè)問題,在myjetty.xml配置文件中,如果想加入jndi的data source的話,應(yīng)該設(shè)置在什么地方啊?放在WEB-INF\jetty-env.xml中的時(shí)候總是讀不出來。而如果用jetty-maven-plugin的話都是沒問題的,而且jetty-env.xml也不一定要放在WEB-INF下面。可以在pom.xml中這樣指定:

    <configuration>
    <scanIntervalSeconds>10</scanIntervalSeconds>
    <jettyEnvXml>${basedir}/src/test/jetty/jetty-env.xml</jettyEnvXml>
    <connectors>
    <connector implementation="org.mortbay.jetty.bio.SocketConnector">
    <port>${localPort}</port>
    <maxIdleTime>60000</maxIdleTime>
    </connector>
    </connectors>
    </configuration>

    而且運(yùn)行也很正常,可是用樓主的方法的話,就怎么都不行了,真是痛苦死了,好想用這種方式在eclipse里debug啊……  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式 2008-04-30 14:55 | ll
    very good!
    但是,修改jsp文件報(bào)文件鎖定,不能修改啊  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式 2008-04-30 20:55 | 我愛佳娃
    不會(huì)呀,我用了很久了,修改JSP和JS文件都不用重啟服務(wù)器,修改函數(shù)內(nèi)的代碼也不需要重啟,只有你加新的方法時(shí)才會(huì)提示重啟。  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式[未登錄] 2008-06-04 14:36 | alfred
    jettyluncher  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式 2008-06-04 20:39 | 我愛佳娃
    我現(xiàn)在每天都在用此博文所指的工具,非常舒服。

    樓上指的是這個(gè)嗎:http://jettylauncher.sourceforge.net/

    我不想再試,有興趣可以嘗試下,好像已經(jīng)停止開發(fā)了。
    Development on this project ended
    The plugin supports only Eclipse 2.x versions and older versions of Jetty (5.x and downwards) and the JVM (1.4/ 1.5)  回復(fù)  更多評(píng)論
      
    # re: 目前發(fā)現(xiàn)的最好最快的直接在ECLIPSE中JETTY調(diào)試方式[未登錄] 2010-01-15 20:11 | Caesar
    @ll
    @ll

    詳見Eclipse Jetty官方文檔
    http://wiki.eclipse.org/Jetty/Troubleshooting

    運(yùn)行Jetty無法保存文件是因?yàn)閃indows的文件處理機(jī)制的限制,原文內(nèi)容如下:
    This is a limitation of Windows -- having a file open in one process means that you can't write to that same file with another process. Since Jetty has mapped the file to its cache, which prevents the file from being edited, you'll need to turn off caching to work around the problem. You can turn off caching in the default servlet by setting <useFileMappedBuffer> to false in webdefault.xml.

    只要修改Jetty安裝目錄下的 /etc/webdefault.xml 中的屬性u(píng)seFileMappedBuffer 為false即可  回復(fù)  更多評(píng)論
      
    主站蜘蛛池模板: 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 亚洲A∨精品一区二区三区| 成人爽a毛片免费| 免费精品视频在线| 亚洲精品无码高潮喷水A片软| 亚洲视频在线免费观看| 亚洲AV无码一区二区乱孑伦AS| 亚洲а∨天堂久久精品| 午夜无遮挡羞羞漫画免费| 亚洲免费视频一区二区三区| 羞羞视频免费观看| 久久亚洲色WWW成人欧美| 精品亚洲AV无码一区二区| 亚洲码在线中文在线观看| 91亚洲国产成人精品下载| 亚洲国产精品国自产拍电影| 国内精品久久久久影院亚洲| 国产精品亚洲综合久久| 国产99久久久久久免费看| 免费能直接在线观看黄的视频| 国产大片免费网站不卡美女| 精品免费人成视频app| 免费永久看黄在线观看app| 亚洲成A人片在线观看无码3D | eeuss影院免费92242部| 色播精品免费小视频| 在线观看亚洲天天一三视| 亚洲国产精品无码久久久秋霞2| 亚洲Av综合色区无码专区桃色| 亚洲国产成人久久99精品| 亚洲日本VA午夜在线影院| 成人A片产无码免费视频在线观看| 久久电影网午夜鲁丝片免费| 韩国18福利视频免费观看| 激情内射亚洲一区二区三区| 亚洲一级视频在线观看| 久久毛片免费看一区二区三区| 日本高清免费观看| 成年女人免费视频播放体验区| 免费v片视频在线观看视频| 亚洲国产精品无码专区|