In a spring-mvc annotated controller:
@RequestMapping(value = "/my")
public class MyController {
@RequestMapping(value = "/something")
public doSomething() {
}
public String getPath() {
return "somethingElse";
}
}
For Restful service, each resource is usually associated with an class in the domain. For example, for User object, my url for update via POST can be /myapp/user; for SomeOtherData, my url would be /myapp/someother.
I want to be able to determine the url for my Restful service given the Class. I want a way to associate a class to the url without having to keep the association elsewhere.
So, is there a way for me to set the path programmatically by calling a method, say getPath(), with Spring MVC?