Organizational Research By

Surprising Reserch Topic

enable cors on embedded jetty using -'jetty,embedded-jetty,swagger-ui'

enable cors on embedded jetty  using -'jetty,embedded-jetty,swagger-ui'

I am trying to enable CORS on Jetty using the following code but I think CORS is still not working. Please help

    FilterHolder holder = new FilterHolder(new CrossOriginFilter());
    holder.setInitParameter("Access-Control-Allow-Origin", "*");
    holder.setInitParameter("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, PATCH, OPTIONS");
    holder.setInitParameter("Access-Control-Allow-Headers", "ontent-Type, api_key, Authorization");

    sch.addFilter(holder, "/*", EnumSet.of(DispatcherType.REQUEST));

when i do

$ curl -I "http://localhost:9000/api-docs/service.json"

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 428


asked Sep 7, 2015 by rajesh
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.