I am using Spring MVC to build the RESTful APIs like:
@RequestMapping(value ="/session={sessionID}&p1={p1}&p2={p2}")
public @ResponseBody
Object getData1(@PathVariable String sessionID,
@PathVariable String p1, @PathVariable String p2) {
return "Get Data";
}
@RequestMapping(value ="/session={sessionID}&p1={p1}&p2={p2}&p3={p3}")
public @ResponseBody
Object getData2(@PathVariable String sessionID,
@PathVariable String p1, @PathVariable String p2, @PathVariable String p3) {
return "Get next Data";
}
But, when I type the url as /session=1&p1=a&p2=b and /session=1/&p1=a&p2=b&p3=c, they always return the same string "Get Data". While debugging, I found that both requests went to the same first method and p2="b&p3=c". It really confuses me :(
Need your help. Thanks. -C