HELP, Resolve an error in Jersery
Hey I'm learning jersey and I'm facing a problem where I'm able to retrieve the data when I'm passing Statically typed address but when I'm trying the same thing with Dynamic address, I'm getting "request entity cannot be empty".
Please Help me out!
Thank You!
If you guys need something to understand this error better feel free to ask me!
Static address:
@GET
@Path("alien/101")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Alien getAlien() {
Alien alien = repo.getAlien(101);
System.out.println("in the parameter ");
if (alien == null) {
// Handle case where no Alien is found
Alien notFoundAlien = new Alien();
notFoundAlien.setId(0);
notFoundAlien.setName("Not Found");
notFoundAlien.setPoints(0);
return notFoundAlien;
}
return alien;
}
Dynamic Address
@GET
@Path("alien/{id}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Alien getAlien(@PathParam("id") int id) {
Alien alien = repo.getAlien(id);
System.out.println("in the parameter ");
if (alien == null) {
// Handle case where no Alien is found
Alien notFoundAlien = new Alien();
notFoundAlien.setId(0);
notFoundAlien.setName("Not Found");
notFoundAlien.setPoints(0);
return notFoundAlien;
}
return alien;
}