I tried working on it. But,not able to figure out the issue since I'm quite new to this. I have attached several screenshots to see the issue I'm facing right now.
@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("rony.java@gmail.com");
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();
}
}
The lack of providers is not relevant, it just means you don't have any.
You have an
index.jsp
, but if you mapped the Jersey filter at the context root (/), it's rightfully saying there's no resource there - based on your screenshots you only have one resource, starting at/emp
which has sub-resources for the CRUD operations at deeper paths.Edit: On second look, your
index.jsp
is in WEB-INF. I don't think it should be based on the fact you appear to be trying to get a simple example together.So, what do you expect to see at
/JerseyRESTCRUD/
?