java - How to name properties of compex @RequestParams in @RestController? -
is possible rename parameters used inside webservice in spring? search.limitresults
in following example:
localhost:8080/firstname=test&search.limitresults=10
you idea. can achieved?
@restcontroller public class myservlet { @requestmapping(value = "/", method = requestmethod.get) private string test(restparams p) { } } @xmlrootelement @xmlaccessortype(xmlaccesstype.field) public class restparams { private string firstname; private string lastname; //is possible nest? @xmlelement(name = "search") private mycomplexsearch search; public mycomplexsearch getsearch() {return search;} public void setsearch(mycomplexsearch) {this.search = search;} @xmlrootelement(name = "search") @xmlaccessortype(xmlaccesstype.field) public class mycomplexsearch { private int limitresults; //some more } }
the request not work code above. instead 1 have use mycomplexsearch
objects name.
localhost:8080/firstname=test&mycomplexsearch.limitresults=10
how can redefine name of input property, without having rename java class itself?
nested classes have static.
public static class mycomplexsearch
Comments
Post a Comment