From: Bill B. <bb...@re...> - 2014-06-09 19:23:46
|
There is no good way to implement this in 2.3.x. You would have to write a resource class to handle all preflight OPTIONS requests. Depending on how you want to validate origins, you'd have to write a PreProcessInterceptor and PostProcessInterceptor and @Context inject a HttpResponse or HttpRequest respectively. FYI, 2.3.x is retired in the community and support and updates are only available by subscription. 3.0.x has been out for a year and can be installed on top of AS7 or EAP 6.x On 6/9/2014 11:50 AM, Gervasio Amy wrote: > Hello all, > > I'm a RESTEasy 2.3.5 version user and I experiencing some issues while > trying to enable CORS. > I'm using this CORS filter implementation > <http://software.dzhuvinov.com/cors-filter.html> (which is basically a > servlet filter) and it works well for successful responses, but when I > have to handle errors through ExceptionMapper, which returns a new > response (for ex. Response.status(Response.Status.FORBIDDEN).build()) it > removes the CORS headers previously set by the filter mentioned. > > I saw there a new CorsFilter > <https://github.com/resteasy/Resteasy/blob/70e918d9bbcd534ce177ae5b0a62b46408cf51e5/jaxrs/resteasy-jaxrs/src/main/java/org/jboss/resteasy/plugins/interceptors/CorsFilter.java> created > in 3.0.7 version, based on interceptors. > > So, my question is: how would I implement CORS in a application which > uses previous version of RESTEasy? > > Thanks in advance, > > Gervasio > > > ------------------------------------------------------------------------------ > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://www.hpccsystems.com > > > > _______________________________________________ > Resteasy-users mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |