Zura Sekhniashvili
Zura Sekhniashvili

Reputation: 1167

use Access-Control-Allow-Origin with Ext.direct and JAVA

I am creating a web application using Ext Js and java for connecting them I am using extdirect spring MVC, but as I want to access my java controller methods from Ext Js from different domain I have the following error OPTIONS http://localhost:8080/hospital/ext/router?_dc=1370605013919 Origin http://localhost is not allowed by Access-Control-Allow-Origin., I search a lot but I could not find how to fix that problem for Ext js. If anyone knows please write me. Thank you beforehand

Upvotes: 1

Views: 2689

Answers (1)

Vitalii Pro
Vitalii Pro

Reputation: 313

The problem with java app. Your app have to add CORS(Cross-origin resource sharing) headers for responses. Access-Control-Allow-Origin: * header of request allows call your service from all other domains.

Required headers can be added using http filters. The example for Spring: http://zhentao-li.blogspot.com/2012/06/enable-cors-support-in-rest-services.html

Upvotes: 1

Related Questions