I resolved this problem reimplementing the sitemesh filter:
@Component
class SitemeshSpringFilter extends PageFilter implements ApplicationContextAware {
ApplicationContext applicationContext;
@Override
public void doFilter(ServletRequest rq, ServletResponse rs,
FilterChain chain) throws IOException, ServletException {
def newRq = new ContextExposingHttpServletRequest(
rq, getApplicationContext(), null);
super.doFilter(newRq, rs, chain);
}
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
}
}
In the web.xml, declare this filter:
<filter>
<filter-name>sitemeshSpringFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>sitemeshSpringFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Now, the sitemesh filter will use ContextExposingHttpServletRequest instead normal request.