You can match the whole path ending in a REST request
@Path("/location/{locationId}{path:.*}") public Response getLocation( @PathParam("locationId") int locationId, @PathParam("path") String path) {
The path variable now contains the full path after location/{locationId}
You can also use regex to make the path optional.
@Path("/user/{id}{format:(/format/[^/]+?)?}{encoding:(/encoding/[^/]+?)?}") public Response getUser( @PathParam("id") int id, @PathParam("format") String format, @PathParam("encoding") String encoding) {
Now, if you format and encode, this will be optional. You do not attach importance, they will be empty.
Emdadul sawon
source share