Jetty と RESTEasy を統合する方法に関するリンクはありますか? RESTEasy と Jetty を一緒に構成しようとしてちょっと行き詰まっています....そして、Web 上には信頼できるヘルプがないようです。
public static void main(String[] args) throws Exception
{
Server server = new Server(8080);
WebAppContext context = new WebAppContext();
context.setDescriptor("../WEB-INF/web.xml");
context.setResourceBase("../src/webapp");
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
server.start();
server.join();
}
私の Web.xml は http://docs.jboss.org/resteasy/docs/1.0.0.GA/userguide/html/Installation_Configuration.htmlから直接コピーされます。
リソース ファイル内のリンクを開こうとすると、返されるエラーは HTTP 404 です。表面上はすべて合理的に見えますが、何か提案はありますか?
私のリソースファイルは次のようになります:
package webapp;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@Path("/*")
public class Resource {
@GET
public String hello() {
return "hello";
}
@GET
@Path("/books")
public String getBooks() {
return "books";
}
@GET
@Path("/book/{isbn}")
public String getBook(@PathParam("isbn") String id) {
return "11123";
}
}
これは、Jetty が起動したときに表示されるプリントです。
2012-04-10 09:54:27.163:INFO:oejs.Server:jetty-8.1.1.v20120215 2012-04-10 09:54:27.288:INFO:oejw.StandardDescriptorProcessor:NO JSP サポート / が見つかりませんでしたorg.apache.jasper.servlet.JspServlet 2012-04-10 09:54:27.319:INFO:oejsh.ContextHandler:開始 oejwWebAppContext{/,file:/C:/Users/xyz/Anotherproj1/src/webapp} 2012-04 -10 09:54:27.319:INFO:oejsh.ContextHandler:開始 oejwWebAppContext{/,file:/C:/Users/xyz/Anotherproj1/src/webapp} 2012-04-10 09:54:27.381:INFO:oejs。 AbstractConnector:開始 SelectChannelConnector@0.0.0.0:8080