Dropwizard + Katharsis:预检(选项)returns 404
Dropwizard + Katharsis: Preflight (OPTIONS) returns 404
我不确定如何配置这两个库以正确处理预检请求(来自 Ember.js)。使用下面的过滤器可以很好地处理标准 Dropwizard/Jersey 资源,但在 Katharsis 发挥作用时什么都不做
FilterRegistration.Dynamic filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class);
filter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, environment.getApplicationContext().getContextPath() + "*");
filter.setInitParameter(ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD");
filter.setInitParameter(ALLOWED_ORIGINS_PARAM, "*");
filter.setInitParameter(ALLOWED_HEADERS_PARAM, "Content-Type," + "X-Requested-With," + "Accept," + "Origin," + "Authorization," + "Access-Control-Request-Method," + "Access-Control-Request-Headers," + "Access-Control-Allow-Origin");
filter.setInitParameter(ALLOW_CREDENTIALS_PARAM, "true");
filter.setInitParameter(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*");
我可以找到一些关于人们如何使用 Spring 解决此问题的示例,但我似乎也无法调整它们以适应这些问题。
我需要用 Katharsis 注册一些特定的东西吗?
OPTIONS is current not supported in Katharsis - 这是一个期待已久的功能。
我不确定如何配置这两个库以正确处理预检请求(来自 Ember.js)。使用下面的过滤器可以很好地处理标准 Dropwizard/Jersey 资源,但在 Katharsis 发挥作用时什么都不做
FilterRegistration.Dynamic filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class);
filter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, environment.getApplicationContext().getContextPath() + "*");
filter.setInitParameter(ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD");
filter.setInitParameter(ALLOWED_ORIGINS_PARAM, "*");
filter.setInitParameter(ALLOWED_HEADERS_PARAM, "Content-Type," + "X-Requested-With," + "Accept," + "Origin," + "Authorization," + "Access-Control-Request-Method," + "Access-Control-Request-Headers," + "Access-Control-Allow-Origin");
filter.setInitParameter(ALLOW_CREDENTIALS_PARAM, "true");
filter.setInitParameter(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "*");
我可以找到一些关于人们如何使用 Spring 解决此问题的示例,但我似乎也无法调整它们以适应这些问题。
我需要用 Katharsis 注册一些特定的东西吗?
OPTIONS is current not supported in Katharsis - 这是一个期待已久的功能。