In the controller , i have this code, somehow, i want to get the request Mapping value \"search\". How is it possible ?
@RequestMapping(\"/search/\")
publ
Having a controller like
@Controller
@RequestMapping(value = "/web/objet")
public class TestController {
@RequestMapping(value = "/save")
public String save(...) {
....
}
}
You cant get the controller base requestMapping using reflection
// Controller requestMapping
String controllerMapping = this.getClass().getAnnotation(RequestMapping.class).value()[0];
or the method requestMapping (from inside a method) with reflection too
//Method requestMapping
String methodMapping = new Object(){}.getClass().getEnclosingMethod().getAnnotation(RequestMapping.class).value()[0];
Obviously works with an in requestMapping single value.
Hope this helps.