2
我創建一個動態java項目,並添加這種依賴性:我缺少運行球衣2網站服務的是什麼?
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-servlet-core -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.23.1</version>
</dependency>
然後創建App類這樣的:
@ApplicationPath("/test")
public class App extends ResourceConfig {
public App() {
this.packages("com.test.ul");
}
}
和在作爲App類是在同一個包,我創建這樣的:
@Path("restaurantAPI")
public class RestaurantAPI {
@Path("/get")
@GET
public Response getRequest(@PathParam("id") String id) {
return Response.ok(id).build();
}
}
我跑我的服務器,我把這個網址:
http://localhost:8080/ULTestServer/test/restaurantAPI/get?id=3
但我得到錯誤404
請問我該錯過什麼? (我總是這樣,它用來工作)