jetty 9 使用
下載jdk 7
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u45-oth-JPR 下載適合操作系統的jdk
jetty 9依賴jdk7 ,最新發布的jdk7u51 jetty9.1.1不支持
下載jetty 9
打開網頁 http://download.eclipse.org/jetty/
選擇jetty9-stable
下載
運行jetty
解壓到 D:/jetty-9.1.1
cd D:/jetty-9.1.1 java –jar start.jar |
使用瀏覽器訪問 http://localhost:8080
返回404錯誤
查看 d:/jetty-9.1.1/webapps/ 目錄為空
將d:/jetty-91.1/demo-base/webapps/ 目錄下的 ROOT 目錄copy 到 D:/jetty-9.1.1/webapps
可以看到ROOT被熱部署
可以看到jetty的歡迎頁面
查看jetty配置
D:\jetty-9.1.1>java -jar start.jar --list-config |
依次展示 java 環境 jetty 環境,jvm參數,系統屬性,classpath,服務器配置文件
修改jetty端口
D:\jetty-9.1.1\start.d\http.ini 文件
--module=http ## HTTP Connector Configuration jetty.port=8080 http.timeout=30000 |
修改 jetty.port=18080
啟動后發現jetty端口變化
jetty 模塊
java -jar start.jar --list-modules |
查看 d:/jetty-9.1.1/start.ini文件
--module=server ## Server Threading Configuration # minimum number of threads threads.min=10 # maximum number of threads threads.max=200 # thread idle timeout in milliseconds threads.timeout=60000 # What host to listen on (leave commented to listen on all interfaces) #jetty.host=myhost.com # Dump the state of the Jetty server, components, and webapps after startup jetty.dump.start=false # Dump the state of the Jetty server, before stop jetty.dump.stop=false
--module=deploy --module=websocket --module=jsp --module=ext --module=resources |
增加模塊
d:/jetty-9.1.1/start.ini 文件 增加 一行
--module=logging |
日志文件配置可以查看 etc/jetty-logging.xml