title: Dropwizard 0.8 - enable CORS
body: <p>Does anyone know how to enable CORS for dropwizard 0.8? I can only find information about version 0.7 <a href="http://jitterted.com/tidbits/2014/09/12/cors-for-dropwizard-0-7-x/" rel="nofollow">here</a>.</p>
  
  <p>apparently this didn't work </p>
  
  <pre><code>FilterRegistration.Dynamic filter = environment.servlets().addFilter(
                  "CORS", CrossOriginFilter.class);
          // Add URL mapping
          filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class),
                  true, "/*");
          filter.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM,
                  "GET,PUT,POST,DELETE,OPTIONS");
          filter.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*");
          filter.setInitParameter(
                  CrossOriginFilter.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*");
          filter.setInitParameter("allowedHeaders",
                  "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin");
          filter.setInitParameter("allowCredentials", "true");
  </code></pre>