{{{ #!html
jetty
}}} [[PageOutline]] = jazz 提供資訊 = * hadoop的web server 是用jetty || $hadoop_home/webapps/task/ || 50060 || || $hadoop_home/webapps/dfs/ || 50070 || || $hadoop_home/webapps/datanode/ || 50010 || || $hadoop_home/webapps/job/ || 50030 || || $hadoop_home/webapps/task/ || 50060 || || $hadoop_home/webapps/dfs/ || 50070 || * 理論上 Jetty 會幫你把 JSP 檔案變成一個 java ,放在 WEB-INF 裡面 ,產生一個 hello_jsp.java = jetty 研究 = * 一個 java的網頁容器,特色是提供一個鑲嵌在應用程式內的網頁伺服器,小巧易用效能又高,提供一個靜態網頁伺服器功能只需300k的記憶體 * a 100% Java HTTP Server and Servlet Container * Open Source jetty特性: * 易用性 1. 通過 XML 或者 API 來對 Jetty 進行配置; 2. 默認配置可以滿足大部分的需求; 3. 將 Jetty 嵌入到應用程序當中只需要非常少的代碼; * 可擴展性 1. 即使在有大量服務請求的情況下(如Ajax 的 Web 2.0),系統的性能也能保持在一個可以接受的狀態。 2. 利用 Continuation 機制來處理大量的用戶請求以及時間比較長的連接。 * 易嵌入性 * Jetty 設計之初就是作為一個優秀的組件來設計的,這也就意味著 Jetty 可以非常容易的嵌入到應用程序當中而不需要程序為了使用 Jetty 做修改。從某種程度上,你也可以把 Jetty 理解為一個嵌入式的Web服務器。 * [http://docs.codehaus.org/display/JETTY/Jetty+Documentation jetty 官方文件] * [http://www.matrix.org.cn/resource/article/2006-08-14/Jetty_44588.html jetty 中文介紹] * [http://www.ibm.com/developerworks/cn/web/wa-lo-jetty/index.html 入門 ] = apt-get 之 jetty = == 安裝jetty == * [http://docs.codehaus.org/display/JETTY/Debian+Packages debian安裝方法] * 在ubuntu用apt-get 安裝得到 jetty 5.1.14版 (2007/8/9) 與 hadoop 0.18.3 的lib 內放的jar檔版本相同 {{{ $ sudo apt-get install jetty jetty-extra }}} * ubuntu 安裝後的目錄與debian有些不同 || /usr/share/jetty/|| || jetty home|| || || cgi-bin/|| 0|| || ||ext/ || 0|| || || lib/ || jar檔|| || || webapps/||root下有預設網站 || ||/usr/share/doc/jetty/ || || 文件目錄|| || /var/log/jetty/|| || log || || /usr/share/java/|| jetty-5.0.0.jar|| 主程式|| || /etc/jetty/|| || 設定檔|| || /etc/default/|| jetty || 0 || || /etc/init.d/|| jetty|| 驅動檔 || == 啟動 jetty == * 設定 jetty -> /etc/jetty/jetty.xml {{{ #!text }}} * 啟動 {{{ $sudo /etc/init.d/jetty start }}} * 瀏覽 [http://localhost:8280/ ] * ps : 不知設定檔如何找出port : * 先用 '''ps aux | jetty''' 找出jetty的pid * 在用pid 來探索 '''netstat -anlp | grep $pid''' ,可查出port號如 {{{ tcp6 0 0 :::8280 :::* LISTEN 30597/java }}} * 預設port在8280 * ps2: jetty的預設網頁裡的[http://localhost:8280/tut/index.html tutorial] 還不錯 = src 之 jetty = == 安裝 == * 此處下載 [http://dist.codehaus.org/jetty/] * 解壓縮即可 == 啟動 == {{{ cd $jetty_home java -jar start.jar etc/jetty.xml }}} = 開發jetty = * [http://www.webtide.com/eclipse/ eclipse plugin ] * [http://www.webtide.com/eclipse/features/org.mortbay.jetty.serveradaptor_1.0.4.jar 1.0.4下載] * 新增 Jetty Web Container 環境(Server)(目前無法使用) [[Image(http://sites.google.com/site/javacodelibrary/_/rsrc/1240252400400/java-net/jetty/Jetty_Eclipse.png?height=366&width=420)]] {{{ #!text 8080 30000 5000 5000 / F:/Data/WebApp config/JettyWeb.xml }}}