我正在尝试在OSX上的IntelliJ中执行以下教程:
http://www.vogella.com/tutorials/REST/article.html
在Eclipse中运行代码时,一切正常。但是在IntelliJ中运行代码会为相同的URI提供404。
该程序应在Apache Tomcat Server 8.0.20上运行。
我已经完全完成了教程中编写的内容,但是我不知道为什么它不能在IntelliJ中使用。我已经搜索了几天,找到了解决方案。
看来部署有问题,因为index.jsp可以正常工作。
希望有人能帮助我。
程序代码:
类您好:
package com.vogella.jersey.first;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
// Plain old Java Object it does not extend as class or implements
// an interface
// The class registers its methods for the HTTP GET request using the @GET annotation.
// Using the @Produces annotation, it defines that it can deliver several MIME types,
// text, XML and HTML.
// The browser requests per default the HTML …
Run Code Online (Sandbox Code Playgroud)