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
Asked
Active
Viewed 2,670 times
1

tereško
- 58,060
- 25
- 98
- 150

Zura Sekhniashvili
- 1,147
- 7
- 19
1 Answers
1
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

Vitalii Pro
- 313
- 2
- 17
-
This is great thank you but I have a little different method in java @ExtDirectMethod public String getSomething (){ return "vasha"; } and I do not know how to add response header here in my method. Thank you – Zura Sekhniashvili Jun 07 '13 at 13:36