I\'m building REST
web app using Netbean 7.1.1 Glassfish 3.1.2
I have 2 URL:
\"http://myPage/resource/getall/name\" (get some
You can specify a regular expression for your Path Parameter (see 2.1.1. @Path).
If you use .*
matches both empty and non empty names
So if you write:
@GET
@Path("getall/{name: .*}")
@Produces("application/json")
public Object Getall(@PathParam("name") String customerName) {
//here I want to call SQL if customerName is not null. is it possible???
}
it will match both "http://myPage/resource/getall" and "http://myPage/resource/getall/name".
@GET
@Path("getall{name:(/[^/]+?)?}")
@Produces("application/json")
public Object Getall(@PathParam("name") String customerName) {
//here I want to call SQL if customerName is not null. is it
possible???
}