public ApiRestletApplication() { super(); parseOperationsForApiRoutes(); // add the CORS service so others can access the service final CorsService corsService = new CorsService(); corsService.setAllowedOrigins(new HashSet(Arrays.asList("*"))); corsService.setAllowedCredentials(true); getServices().add(corsService); }
@Override public Filter createInboundFilter(Context context) { return new CorsFilter().setAllowedCredentials(allowedCredentials) .setAllowedOrigins(allowedOrigins) .setAllowingAllRequestedHeaders(allowingAllRequestedHeaders) .setAllowedHeaders(allowedHeaders) .setExposedHeaders(exposedHeaders) .setSkippingResourceForCorsOptions(skippingResourceForCorsOptions) .setDefaultAllowedMethods(getDefaultAllowedMethods()) .setMaxAge(maxAge); }