I am currently trying to add a new feature to my REST API.
Basically I want to add the ability to add query parameters to the end of a path and turn this into a Map of all the query options for example.
my current code allows me to do things like
localhost:8181/cxf/check/
localhost:8181/cxf/check/format
localhost:8181/cxf/check/a/b
localhost:8181/cxf/check/format/a/b
and this will use all the @pathparam as String variables to generate a response.
What I want to do now is add:
localhost:8181/cxf/check/a/b/?x=abc&y=def&z=ghi&...
localhost:8181/cxf/check/format/a/b/?x=abc&y=def&z=ghi&...
and I would then have this generate a Map which can be used along with the pathparam to build the response
x => abc
y => def
z => ghi
... => ...
I was thinking something like this [Below] however the @QueryParam seem to only handle one key value and not a Map of them.
@GET
@Path("/{format}/{part1}/{part2}/{query}")
Response getCheck(@PathParam("format") String format, @PathParam("part1") String part1, @PathParam("part2") String part2, @QueryParam("query") Map<K,V> query);
below is my current interface code.
@Produces(MediaType.APPLICATION_JSON)
public interface RestService {
@GET
@Path("/")
Response getCheck();
@GET
@Path("/{format}")
Response getCheck(@PathParam("format") String format);
@GET
@Path("/{part1}/{part2}")
Response getCheck(@PathParam("part1") String part1,@PathParam("part2") String part2);
@GET
@Path("/{format}/{part1}/{part2}")
Response getCheck(@PathParam("format") String format, @PathParam("part1") String part1, @PathParam("part2") String part2);
}