I want to customize the page controller in a DXA JAVA implementation. How can we doIs that possible, and how?
I tried to extend the DXA PageController, but of course that does not work
@Controller
public class MyPageController extends PageController {
@RequestMapping(
value = {"/jan"},
params = {"test"},
produces = {"text/html", "*/*"}
)
@Override
public String handleGetPage(HttpServletRequest request, HttpServletResponse response) throws Exception {
// do your stuff
return super.handleGetPage(request, response);
}
}
The problem is that in Spring there is no way to override the @RequestMapping
, and each mapping has to be unique.
@bearddev had a similar question for DXA .NET. The .NET answer does not apply to DXA JAVA as routing is not configured in a single place in DXA JAVA.
The DXA documentation mentions how to "Create a controller class", but that only applies to region and entity controllers.