You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Radhakrishna Kalyan <nr...@gmail.com> on 2014/04/03 13:50:29 UTC

Need help with Access-Control-Allow-Origin

Hi,

I have a standalone Openejb application which exposes few rest calls.
I am writing a AngularJs application to access those rest methods, but I
was not able to see the data in the angularjs application, but it works
fine when I try to call the rest url from a browser..
Later I discovered that "Access-Control-Allow-Origin" is missing in the
response header.

I have fixed by adding
httpServletResponse.addHeader(CorsHeaderConstants.HEADER_AC_ALLOW_ORIGIN,
         "*");
in the rest method.

I tried using @CrossOriginResourceSharing(allowAllOrigins = true) but it
didn't work either.

I would like to know is there any other way of doing this.
Any pointers would be really helpful.

-- 
Thanks and Regards
N Radhakrishna Kalyan

P:  +46 733 312 584
http://about.me/nrkkalyan
<http://about.me/nrkkalyan>

Re: Need help with Access-Control-Allow-Origin

Posted by Radhakrishna Kalyan <nr...@gmail.com>.
Thank you rmannibucau.
I have fixed the issue by adding dependency to "cxf-rt-rs-security-cors"
jar and adding the following property
cxf.jaxrs.providers =
org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter




On Thu, Apr 3, 2014 at 1:50 PM, Radhakrishna Kalyan <nr...@gmail.com>wrote:

> Hi,
>
> I have a standalone Openejb application which exposes few rest calls.
> I am writing a AngularJs application to access those rest methods, but I
> was not able to see the data in the angularjs application, but it works
> fine when I try to call the rest url from a browser..
> Later I discovered that "Access-Control-Allow-Origin" is missing in the
> response header.
>
> I have fixed by adding
> httpServletResponse.addHeader(CorsHeaderConstants.HEADER_AC_ALLOW_ORIGIN,
>          "*");
> in the rest method.
>
> I tried using @CrossOriginResourceSharing(allowAllOrigins = true) but it
> didn't work either.
>
> I would like to know is there any other way of doing this.
> Any pointers would be really helpful.
>
> --
> Thanks and Regards
> N Radhakrishna Kalyan
>
> P:  +46 733 312 584
> http://about.me/nrkkalyan
> <http://about.me/nrkkalyan>
>



-- 
Thanks and Regards
N Radhakrishna Kalyan

P:  +46 733 312 584
http://about.me/nrkkalyan
 <http://about.me/nrkkalyan>