I have three REST API methods:
@RequestMapping(value = "/{name1}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1) throws UnsupportedEncodingException {
return configService.getConfig("frontend", name1);
}
@RequestMapping(value = "/{name1}/{name2}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1, @PathVariable String name2) throws UnsupportedEncodingException {
return configService.getConfig("frontend", name1, name2);
}
@RequestMapping(value = "/{name1}/{name2}/{name3}", method = RequestMethod.GET)
public Object retrieve(@PathVariable String name1, @PathVariable String name2, @PathVariable String name3) {
return configService.getConfig("frontend", name1, name2,name3);
}
The getConfig method is configured to accept several parameters, such as:
public Object getConfig(String... names) {
My question is: is it possible to execute the above RequestMapping using only one / RequestMapping method?
Thank.
source
share