Another beginner question. Is there any mechanism in Jersey for trapping
the condition that too many or too few
path segments exist, with out creating a template for each possible
error (e.g. REGEX).
In this example, testIT requires 2 and only 2 segments following .../test/
@GET
@Path("test/{item1}/{item2}")
public String getFileState(
@PathParam("item1") String item1,
@PathParam("item2") String item2)
{
return "**" + item1 + "**" + item2 + "**";
}
One approach is to include a @Path for every exception.
@GET
@Path("test/{item1}")
public String getFileState()
{
throw new WebApplicationException(400);
}
@GET
@Path("test/{item1}/{item2}/{item3}")
public String getFileState()
{
throw new WebApplicationException(400);
}
@GET
@Path("test/{item1}/{item2}/{item3}/{item4}")
public String getFileState()
{
throw new WebApplicationException(400);
}
Is there some wild card mechanism on @Path to handle the too many
condition? Is there some general mechanism
to specify that only 2 path elements are allowed following test/?
Thanks
David