You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Pedro Alba <pe...@ticxar.com> on 2016/05/24 19:28:51 UTC
Problems with isis rest
Good afternoon.
I would like to know how to consume services exposed isis rest apache
applications from HTML pages, as consumption the following error message:
No 'Access-Control-Allow-Origin' header is present on the requested
resource. Origin 'null' is not allowed access THEREFORE. The response HTTP
status code 404 ADH.
Thanks.
[image: Logo]
*Pedro Antonio Alba *
*Senior Development Analyst*
Tel: (57) 1 703 17 77
Cel: (57) 301 3379810
E-mail: pedro.alba@ticxar.com
Calle 93 # 19b - 66 Ofc 202
Bogotá D.C., Colombia
www.ticxar.com
[image: facebook]
<http://www.facebook.com/pages/Ticxar/446503822192581> [image:
twitter] <http://twitter.com/ticxar> [image: linkedIn]
<http://www.linkedin.com/company/ticxar>
Re: Problems with isis rest
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
I suggest that as a first attempt to host your HTML pages on localhost, and
have the URL to the Restful rsources be relative to them, eg
"../restful/services/" and so on.
Once you get that going, have a look again at CORS (there's also lots of
material on t'internet about CORS for you to check out).
Dan
On 25 May 2016 at 00:06, Pedro Alba <pe...@ticxar.com> wrote:
> I followed his advice, but I still can consume the rest services generated
> by the application.
>
> I have tried the following:
>
> / *************************************************
> ****************************************** /
> <Filter-name> CORS Filter </ filter-name>
> <Filter-class> org.ebaysf.web.cors.CORSFilter </ filter-class>
> <Init-param>
> <Param-name> cors.allowed.origins </ param-name>
> <Param-value> * </ param-value>
> </ Init-param>
> <Init-param>
> <Param-name> cors.allowed.headers </ param-name>
>
>
> <param-value>Content-Type,Accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization,Cache-Control,If-Modified-Since,Pragma</param-value>
> </ Init-param>
> </ Filter>
> <Filter-mapping>
> <Filter-name> CORS Filter </ filter-name>
> <Url-pattern> / * </ url-pattern>
> </ Filter-mapping>
>
> <Filter-mapping>
> <Filter-name> ShiroFilter </ filter-name>
> <Url-pattern> / * </ url-pattern>
> </ Filter-mapping>
>
> / *************************************************
> ****************************************** /
>
> but the results are negative trying locally.
>
> Could you guide me with some other step or recommendation?
>
> 2016-05-24 14:35 GMT-05:00 Dan Haywood <da...@haywood-associates.co.uk>:
>
> > This is the standard cross-origin error; "cross origin" here means:
> > * origin = the origin of the resources, ie the host you are accessing
> > * cross = a different origin than the one that served up the HTML page.
> >
> > In other words, your HTML page is trying to access the REST resources but
> > those REST resources are on a different host,
> >
> > You either need to locate ensure the host name is the same, or you can
> > confirm a CORS filter in your web.xml.
> >
> > The contactapp [1] shows both of these approaches, see [2] and [3]
> > respectively
> >
> > HTH
> > Dan
> >
> >
> >
> > [1] https://github.com/incodehq/contactapp
> > [2]
> >
> >
> https://github.com/incodehq/contactapp/tree/master/backend/webapp/src/main/webapp/mobile
> > [3]
> >
> >
> https://github.com/incodehq/contactapp/blob/master/backend/webapp/src/main/webapp/WEB-INF/web.xml#L38
> >
> >
> >
> >
> > On 24 May 2016 at 20:28, Pedro Alba <pe...@ticxar.com> wrote:
> >
> > > Good afternoon.
> > >
> > > I would like to know how to consume services exposed isis rest apache
> > > applications from HTML pages, as consumption the following error
> message:
> > > No 'Access-Control-Allow-Origin' header is present on the requested
> > > resource. Origin 'null' is not allowed access THEREFORE. The response
> > HTTP
> > > status code 404 ADH.
> > >
> > > Thanks.
> > >
> > >
> > > [image: Logo]
> > >
> > > *Pedro Antonio Alba *
> > > *Senior Development Analyst*
> > > Tel: (57) 1 703 17 77
> > > Cel: (57) 301 3379810
> > > E-mail: pedro.alba@ticxar.com
> > > Calle 93 # 19b - 66 Ofc 202
> > > Bogotá D.C., Colombia
> > > www.ticxar.com
> > >
> > >
> > >
> > > [image: facebook]
> > > <http://www.facebook.com/pages/Ticxar/446503822192581> [image:
> > > twitter] <http://twitter.com/ticxar> [image: linkedIn]
> > > <http://www.linkedin.com/company/ticxar>
> > >
> >
>
>
>
> --
>
> [image: Logo]
>
> *Pedro Antonio Alba *
> *Senior Development Analyst*
> Tel: (57) 1 703 17 77
> Cel: (57) 301 3379810
> E-mail: pedro.alba@ticxar.com
> Calle 93 # 19b - 66 Ofc 202
> Bogotá D.C., Colombia
> www.ticxar.com
>
>
>
> [image: facebook]
> <http://www.facebook.com/pages/Ticxar/446503822192581> [image:
> twitter] <http://twitter.com/ticxar> [image: linkedIn]
> <http://www.linkedin.com/company/ticxar>
>
Re: Problems with isis rest
Posted by Pedro Alba <pe...@ticxar.com>.
I followed his advice, but I still can consume the rest services generated
by the application.
I have tried the following:
/ *************************************************
****************************************** /
<Filter-name> CORS Filter </ filter-name>
<Filter-class> org.ebaysf.web.cors.CORSFilter </ filter-class>
<Init-param>
<Param-name> cors.allowed.origins </ param-name>
<Param-value> * </ param-value>
</ Init-param>
<Init-param>
<Param-name> cors.allowed.headers </ param-name>
<param-value>Content-Type,Accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization,Cache-Control,If-Modified-Since,Pragma</param-value>
</ Init-param>
</ Filter>
<Filter-mapping>
<Filter-name> CORS Filter </ filter-name>
<Url-pattern> / * </ url-pattern>
</ Filter-mapping>
<Filter-mapping>
<Filter-name> ShiroFilter </ filter-name>
<Url-pattern> / * </ url-pattern>
</ Filter-mapping>
/ *************************************************
****************************************** /
but the results are negative trying locally.
Could you guide me with some other step or recommendation?
2016-05-24 14:35 GMT-05:00 Dan Haywood <da...@haywood-associates.co.uk>:
> This is the standard cross-origin error; "cross origin" here means:
> * origin = the origin of the resources, ie the host you are accessing
> * cross = a different origin than the one that served up the HTML page.
>
> In other words, your HTML page is trying to access the REST resources but
> those REST resources are on a different host,
>
> You either need to locate ensure the host name is the same, or you can
> confirm a CORS filter in your web.xml.
>
> The contactapp [1] shows both of these approaches, see [2] and [3]
> respectively
>
> HTH
> Dan
>
>
>
> [1] https://github.com/incodehq/contactapp
> [2]
>
> https://github.com/incodehq/contactapp/tree/master/backend/webapp/src/main/webapp/mobile
> [3]
>
> https://github.com/incodehq/contactapp/blob/master/backend/webapp/src/main/webapp/WEB-INF/web.xml#L38
>
>
>
>
> On 24 May 2016 at 20:28, Pedro Alba <pe...@ticxar.com> wrote:
>
> > Good afternoon.
> >
> > I would like to know how to consume services exposed isis rest apache
> > applications from HTML pages, as consumption the following error message:
> > No 'Access-Control-Allow-Origin' header is present on the requested
> > resource. Origin 'null' is not allowed access THEREFORE. The response
> HTTP
> > status code 404 ADH.
> >
> > Thanks.
> >
> >
> > [image: Logo]
> >
> > *Pedro Antonio Alba *
> > *Senior Development Analyst*
> > Tel: (57) 1 703 17 77
> > Cel: (57) 301 3379810
> > E-mail: pedro.alba@ticxar.com
> > Calle 93 # 19b - 66 Ofc 202
> > Bogotá D.C., Colombia
> > www.ticxar.com
> >
> >
> >
> > [image: facebook]
> > <http://www.facebook.com/pages/Ticxar/446503822192581> [image:
> > twitter] <http://twitter.com/ticxar> [image: linkedIn]
> > <http://www.linkedin.com/company/ticxar>
> >
>
--
[image: Logo]
*Pedro Antonio Alba *
*Senior Development Analyst*
Tel: (57) 1 703 17 77
Cel: (57) 301 3379810
E-mail: pedro.alba@ticxar.com
Calle 93 # 19b - 66 Ofc 202
Bogotá D.C., Colombia
www.ticxar.com
[image: facebook]
<http://www.facebook.com/pages/Ticxar/446503822192581> [image:
twitter] <http://twitter.com/ticxar> [image: linkedIn]
<http://www.linkedin.com/company/ticxar>
Re: Problems with isis rest
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
This is the standard cross-origin error; "cross origin" here means:
* origin = the origin of the resources, ie the host you are accessing
* cross = a different origin than the one that served up the HTML page.
In other words, your HTML page is trying to access the REST resources but
those REST resources are on a different host,
You either need to locate ensure the host name is the same, or you can
confirm a CORS filter in your web.xml.
The contactapp [1] shows both of these approaches, see [2] and [3]
respectively
HTH
Dan
[1] https://github.com/incodehq/contactapp
[2]
https://github.com/incodehq/contactapp/tree/master/backend/webapp/src/main/webapp/mobile
[3]
https://github.com/incodehq/contactapp/blob/master/backend/webapp/src/main/webapp/WEB-INF/web.xml#L38
On 24 May 2016 at 20:28, Pedro Alba <pe...@ticxar.com> wrote:
> Good afternoon.
>
> I would like to know how to consume services exposed isis rest apache
> applications from HTML pages, as consumption the following error message:
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'null' is not allowed access THEREFORE. The response HTTP
> status code 404 ADH.
>
> Thanks.
>
>
> [image: Logo]
>
> *Pedro Antonio Alba *
> *Senior Development Analyst*
> Tel: (57) 1 703 17 77
> Cel: (57) 301 3379810
> E-mail: pedro.alba@ticxar.com
> Calle 93 # 19b - 66 Ofc 202
> Bogotá D.C., Colombia
> www.ticxar.com
>
>
>
> [image: facebook]
> <http://www.facebook.com/pages/Ticxar/446503822192581> [image:
> twitter] <http://twitter.com/ticxar> [image: linkedIn]
> <http://www.linkedin.com/company/ticxar>
>