#這篇是翻譯文章,並且補充說明
RESTEasy Hello World Example
開發環境
- Eclipse Kepler
- JBoss 6.x Runtime Server
- RESTEasy 2.2.1.GA
- jre7
Download Source Code
Download it – RESTEasy-Hello-World-Example.zip (7 KB)
當把檔案下載回來後
1. Import 進你的專案目錄
2. 找不到這些jar檔嗎?
M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.2.1.GA/resteasy-jaxrs-2.2.1.GA.jar
M2_REPO/org/jboss/resteasy/jaxrs-api/2.2.1.GA/jaxrs-api-2.2.1.GA.jar
M2_REPO/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar
M2_REPO/org/apache/httpcomponents/httpclient/4.0.3/httpclient-4.0.3.jar
M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar
M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar
M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
請至 RESTEasy 下載 RESTEasy 2.2.1.GA
或到 sourceforge 下載 resteasy-jaxrs-2.2.1.GA-all.zip
然後重新修改你import的Libraries
- Java Build Path -> Libraries
重新加入你下載回來的這些jar檔
- resteasy-jaxrs-2.2.1.GA.jar
- jaxrs-api-2.2.1.GA.jar
- httpcore-4.0.1.jar
- httpclient-4.0.3.jar
- commons-codec-1.2.jar
- commons-httpclient-3.1.jar
- commons-logging-1.0.4.jar
接著
- Run AS-> Run as Server
選擇
- JBoss 6.x Runtime Server
確認你的JBoss work 之後
訪問
Test 1 : http://localhost:8080/RESTfulExample/rest/message/mkyong
Test 2 : http://localhost:8080/RESTfulExample/rest/message/hello%20world
Good Luck!
沒有留言:
張貼留言
選擇[匿名]選項可直接留言