Spring MVC: get RequestMapping value in the method -


in app, reasons able value of @requestmapping in corresponding methods, however, can't find way that. here more details want:

suppose, have method this:

 @requestmapping(value = "/hello") @responsebody public void hellomethod(atmosphereresource atmosphereresource) { ... } 

i able mapping "/hello" within method. know, can use placeholders in mapping in order values when actual requests come, need finite set of processable requests, , don't want chain of ifs or switches in method.

is @ possible?

this effectively same, wouldn't it?

private final static string mapping = "/hello";  @requestmapping(value = mapping) @responsebody public void hellomethod(atmosphereresource atmosphereresource) {    // mapping accessible it's stored in instance variable } 

but answer original question: wouldn't surprised if there wasn't direct way access that, it's difficult think of valid reasons access information in controller code (imo 1 of biggest benefits of annotated controllers can forget underlying web layer , implement them plain, servlet-unaware methods)


Comments