I have implemented Spring Security 3.1 on top of Spring MVC 3.1.3 with the UI developed with Dojo 1.4. The application has few controllers which handle binary files uploaded through dojo.io.iframe.send. The controller sends a json response which has to be surrounded withTo to this, I've implemented a custom filter and placed it after Spring Security's filter chain in web.xml:HTML Code:<html><body><textarea>{my json response}</textarea></body></html>
The filter's doFilter has this behaviour taken from: http://www.oracle.com/technetwork/ja...rs-137243.htmlCode:<filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <async-supported>true</async-supported> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>dojoIframeFilter</filter-name> <filter-class>com.app.web.MultipartAjaxFilter</filter-class> </filter> <filter-mapping> <filter-name>dojoIframeFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
The wrapper's output is empty. I've also tried many other combinations such as placing the custom filter for spring's dispatcher servlet, doing away with the if block inside doFilter none of which works. I also tried writing a Spring interceptor which also failed.Code:public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request.getContentType() != null && request.getContentType().contains("multipart/form-data")) { CharResponseWrapper wrapper = new CharResponseWrapper((HttpServletResponse) response); chain.doFilter(request, wrapper); log.info(wrapper.toString()); //Modify response here to add html tags } else { chain.doFilter(request, response); } }
What is the right way to modify the response sent from controller with spring security in place ?


Reply With Quote
