I'm wondering if there's a way handle query params in a way similar to CXF with an object instead of having to explicitly list out query params. Additionally, even if I have to list them query params, I have a number of GET methods with exactly the same set of queries and I'd like to avoid duplication.
In CXF, I'd instead have a method with an (@QueryParam("") FooSearch search) in a method and it would use reflection to instantiate that object and then fill in data. I'm going to have a large number of these and I'm having to copy and paste every one of the params and then have handler that takes in each of the headers and invokes the handler which instantiates the actual object I pass to the mediation layer and back end of querying the database. I have at least 10 methods and will likely have many more than that and will have to repeat each param().name() combination. It is likely that future search fields will also be added. This isn't just tedious, it is quite error prone as any misspelling or mistake will break the code at runtime. I tried putting the params before the .get() to see if I could at least make it global specification without any luck. With CXF I'd also be able to use the @WebMethod to do routing to invoke the correct route or method with toD or by using a bean but now I have to create individual handlers for each one. Any help or suggestions would be appreciated. rest("/bar").get("/details") .param().name("someId").type(RestParamType.query).required(false).endParam() .param().name("ssn").type(RestParamType.query).required(false).endParam() .param().name("anotherNumber").type(RestParamType.query).required(false).end Param() .description("Get all the by the bars.") .outType(SomeClass.class) .route().id("route-details") .bean(BarHandler.class); What I'd prefer, is something like this and perhaps it already exists? rest("/bar").get("/details") .param().name("search").type(RestParamType.query).type(FooSearch.class) endParam() .description("Get all the by the bars.") .outType(SomeClass.class) .route().id("route-details") .bean(BarHandler.class); The BarHandler class. public Member search(@Header("someId") String someId, @Header("ssn") String ssn, @Header("anotherNumber") String anotherNumber) { new FooSearch(someId,ssn,anotherNumber) Do something in here. }