I'm working on a dropwizard application and js ui to interacte with the api. I need to load json data to update views but I have to enable cors in dropwizard before that. I did some staff but it seems not working because dropwizard returns allways 204 no content.
@Override
public void run(final BGConfiguration configuration, final Environment environment) throws Exception {
final Map<String, String> params = new HashMap<>();
params.put("Access-Control-Allow-Origin", "/*");
params.put("Access-Control-Allow-Credentials", "true");
params.put("Access-Control-Expose-Headers", "true");
params.put("Access-Control-Allow-Headers", "Content-Type, X-Requested-With");
params.put("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
environment.servlets().addFilter("cors", CrossOriginFilter.class).setInitParameters(params);
}