Closed cgendreau closed 9 years ago
2 possible solutions:
Reuse the Freemarker ViewResolver to resolve the decorator templates by simply adding a @RequestMapping
annotation for /decorators/*
in the controller. Then, return a ModelAndView object for the decorator. This solution is fast to implement but brings new issues. It exposes the URL for the layout so an internal check must be done to only accept internal forwards. It also becomes error prone in case a decorator and a view would have the same name since they both load from the same ViewResolver.
Use the ServletWrappingController to wrap our implementation of FreemarkerServlet
. Then, use SimpleUrlHandlerMapping to map decorator URLs to our controller. Note that ServletWrappingController
will not give the expected result when calling getPathInfo
(always null), this needs to be solved in our FreemarkerServlet implementation.
Which of the two solutions are easiest to maintain and least prone to confusion later? At first glance, it seems like the second solution is best to avoid potential clashes with decorator and view naming.
yes the second solution will be used.
For the records, ServletWrappingController
will not used because dependency injection is required by our setup. Instead, we will instantiate our SpringFreemarkerDecoratorServlet
and use it with Spring's SimpleServletHandlerAdapter
.
Vascan should start to use the canadensys-web-core and canadensys-web-theme projects. Those components should be resused in Canadensys web apps. SiteMesh3 is required in order to reuse the Canadensys theme but is also very useful to simplify page layout.