I am making a test RESTful
service which has the role of returning a result of two numbers forwarded via the URL
. I'm currently trying: http://localhost:8080/XMLWSAssignment/AddService/3/5
to combine 3 + 5. However, I am greeted with a "404"
error in GlassFish...
Here's the code:
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.PathParam;
@Path("/MyRestService")
public class MyRestClass {
@Path("/AddService/{a}/{b}")
public class AddService {
@GET
public String getMessage(@PathParam("a") Integer a, @PathParam("b") Integer b) {
Integer res = a + b;
return res.toString();
}
}
}
Aucun commentaire:
Enregistrer un commentaire