final OpenSessionInViewFilter filter2 = new OpenSessionInViewFilter();
filter2.init(filterConfig2);
final OpenSessionInViewFilter filter3 = new OpenSessionInViewFilter();
filter3.init(filterConfig3);
final FilterChain filterChain = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(sf));
// check sf-related things
assertSame(holder, TransactionSynchronizationManager.getResource(sf));
assertSame(session, holder.getSession());
servletRequest.setAttribute("invoked", Boolean.TRUE);
}
};
final FilterChain filterChain2 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(sf));
// check sf-related things
assertSame(holder, TransactionSynchronizationManager.getResource(sf));
assertSame(session, holder.getSession());
filter3.doFilter(servletRequest, servletResponse, filterChain);
}
};
final FilterChain filterChain3 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
assertTrue(TransactionSynchronizationManager.hasResource(sf2));
// check sf2-related things
assertSame(holder2, TransactionSynchronizationManager.getResource(sf2));
assertSame(session2, holder2.getSession());
filter.doFilter(servletRequest, servletResponse, filterChain2);
}
};
FilterChain filterChain4 = new FilterChain() {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
filter2.doFilter(servletRequest, servletResponse, filterChain3);
}
};