Spring 3.0 ile isteğe bağlı bir yol değişkenim olabilir mi?
Örneğin
@RequestMapping(value = "/json/{type}", method = RequestMethod.GET)
public @ResponseBody TestBean testAjax(
HttpServletRequest req,
@PathVariable String type,
@RequestParam("track") String track) {
return new TestBean();
}
Burada istiyorum /json/abcveya /jsonaynı yöntemi çağırmak için.
Açık bir geçici çözüm typeistek parametresi olarak bildirilir:
@RequestMapping(value = "/json", method = RequestMethod.GET)
public @ResponseBody TestBean testAjax(
HttpServletRequest req,
@RequestParam(value = "type", required = false) String type,
@RequestParam("track") String track) {
return new TestBean();
}
ve sonra /json?type=abc&track=aaya /json?track=rrda çalışacak