The DXA documentation (Java) at https://docs.sdl.com/784837/748207/sdl-digital-experience-accelerator-2-2/creating-custom-models-and-controllers gives this example of how to create a custom entity controller
@Controller
@RequestMapping("/system/mvc/Example/ExampleController")
public class TestController extends BaseController {
@Autowired
private WebRequestContext webRequestContext;
@RequestMapping(method = RequestMethod.GET, value = "DoStuff/{regionName}/{entityId}")
public String handleGetEntity(HttpServletRequest request,
@PathVariable String regionName,
@PathVariable String entityId) throws ContentProviderException {
return "Hello world";
}
}
So we have two RequestMapping annotations, the first on the class:
@RequestMapping("/system/mvc/Example/ExampleController")
and the second on the method
@RequestMapping(method = RequestMethod.GET, value = "DoStuff/{regionName}/{entityId}")
I'm assuming that the first is used to allow the framework to locate the right controller. In this case if I have a module initialiser whose getAreaName() returns "Foo" and for which there is a @RegisteredViewModel with controllerName = "Bar", then presumably the annotation on my controller class should be:
@RequestMapping("/system/mvc/Foo/Bar")
Is this correct? Is the name of the class itself also relevant? Are other elements necessary in the mapping?
In the second mapping (on the method) what does "DoStuff" mean? Is "regionName" the name of the region, or the area.
Is there any other documentation available that I might have missed? Or examples?