i am trying to understand rest webservices and came a cross dynamic url building. below is piece of code i found in examples
@Path("/customers")
public class CustomerResource {
@GET
@Path("{id : \\d+}")
public String getCustomer(@PathParam("id") int id) {
...
}
}
@GET
@Path("{id : .+}")
public String getCustomer(@PathParam("id") String id) {
...
}
Path attribute is build using regular expression. i tried google and found some info but i am still confused
{}
is this is used as range like a{2,3}
means a should be atleast 2 times
.+
is any character at least should occur once
\d+
at least one digit
but i am unable to imagine which string matches {id : .+} and {id : \\d+}
can you please help me understand