我嘗試瞭解它。但是,由於我對此很陌生,無法弄清楚這個問題。我附上了幾個截圖,以查看我現在面臨的問題。找不到提供程序類:運行Jersey REST示例應用程序時
@Path("/emp")
public class EmployeeService {
@GET
@Path("/emp/{empID}")
@Produces(MediaType.APPLICATION_XML)
public Employee getEmployee(@PathParam(value = "empID") String empID) {
Employee employee = new Employee();
employee.setEmailId(empID);
employee.setName("Rony John");
employee.setEmailId("[email protected]");
return employee;
}
@POST
@Path("/create")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Employee createEmployee(Employee employee) {
// Create logic
return employee;
}
@POST
@Path("/update")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Employee updateEmployee(Employee employee) {
employee.setName(employee.getName() + " updated");
return employee;
}
@DELETE
@Path("/delete/{empID}")
public Response deleteEmployee(@PathParam(value = "empID") String empID) {
return Response.status(200)
.entity("Employee with " + empID + " is deleted successfully.")
.build();
}
}
你的EmployeeService類是什麼樣的? – condit 2013-03-14 14:54:54
附上了代碼。 – AppSensei 2013-03-14 18:31:25
http:// localhost:8080/JerseyRESTCRUD/emp/test是否可以做任何事情?你期待在http:// localhost:8080/JerseyRESTCRUD /?上看到什麼? – condit 2013-03-14 18:35:09