天天看點

jetty 9使用

jetty 9 使用

jetty 9依賴jdk7 ,最新釋出的jdk7u51 jetty9.1.1不支援

選擇jetty9-stable

下載下傳

<a href="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.1.1.v20140108.zip&amp;r=1">jetty-distribution-9.1.1.v20140108.zip</a>

解壓到  D:/jetty-9.1.1

   cd D:/jetty-9.1.1

   java –jar start.jar

傳回404錯誤

檢視  d:/jetty-9.1.1/webapps/  目錄為空

将d:/jetty-91.1/demo-base/webapps/  目錄下的  ROOT 目錄copy 到 D:/jetty-9.1.1/webapps 

可以看到ROOT被熱部署

可以看到jetty的歡迎頁面

D:\jetty-9.1.1&gt;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端口變化

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