Class JsonpFilter

java.lang.Object
nl.vpro.web.filter.jsonp.JsonpFilter
All Implemented Interfaces:
javax.servlet.Filter

public class JsonpFilter extends Object implements javax.servlet.Filter

Wraps a JSON response with padding and sets the response content type to application /javascript. This filter is triggered when a callback parameter is present on the URL containing the name for the callback method to use. If the name for the callback parameter is to obvious, you can supply an alternative value in this filters init config.

  • Constructor Details

    • JsonpFilter

      public JsonpFilter()
  • Method Details

    • init

      public void init(javax.servlet.FilterConfig config)
      Specified by:
      init in interface javax.servlet.Filter
    • doFilter

      public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
      Specified by:
      doFilter in interface javax.servlet.Filter
      Throws:
      IOException
      javax.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface javax.servlet.Filter