view source
Tutorial: Implementing a Servlet Filter for JSONP callback with Spring’s DelegatingFilterProxy
In my previous tutorial, I talked about creating a web application using Spring Roo, Hibernate EntityManager and JSONP for cross-domain AJAX calls. I also mentioned some trouble I had using @ResponseBody to generate JSON output. When asked by SpringSource’s Keith Donald what the issue was, I was completely unable to reproduce it, although I remembered it having something to do with Jackson not being found on my classpath and an exception being thrown, even though it was there. Further feedback from SpringSource’s Jeremy Grelle suggested that I remove the JSONP callback handling from my controller and place it in either a servlet filter or an MVC HandlerInterceptor.
Advertisement