I created a simple CRUD interface, where my READ is a
@GET
@Path("{location_id: [a-zA-Z0-9_]+}")
@Produces({ MediaType.APPLICATION_XML,
MediaType.APPLICATION_JSON })
@Override
public Location getLocation(@PathParam("location_id") String
id) {...}
So, I am limiting the READ to certain location IDs.
Then I had a CREATE (PUT) that was NOT recognized by REST, unless I use
the
regex.
@PUT
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("{location_id}")
@Override
public Response addLocation(@PathParam("location_id") String
id) {...}
The above method was not recognized (REST could not find a match).
Then, I changed it to
@PUT
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("{location_id: [a-zA-Z0-9_]+}")
@Override
public Response addLocation(@PathParam("location_id") String
id) {..}
and my method was recognized.
So, it seems that somehow the REST matcher is expecting that once
I use a regex for location_id, I have to use it always?