Use regular expressions to map variable URI path fragments
5.1. Advanced @PathParam and Regular Expressions There are a few more complicated uses of @PathParams not discussed in the previous section. You are allowed to specify one or more path params embedded in one URI segment. Here are some examples: 1. @Path("/aaa{param}bbb") 2. @Path("/{name}-{zip}") 3. @Path("/foo{name}-{zip}bar") So, a URI of "/aaa111bbb" would match #1. "/bill-02115" would match #2. "foobill-02115bar" would match #3. We discussed before how you can use regular expression patterns within @Path values. @GET @Path("/aaa{param:b+}/{many:.*}/stuff") public String getIt(@PathParam("param") String bs, @PathParam("many") String many) {...} For the following requests, lets see what the values of the "param" and "many" @PathParams would be: Table 5.1. Request param many GET /aaabb/some/stuff bb some GET /aaab/a/lot/of/stuff b a/lot/of