我使用RestyGWT與在JBoss AS7遠程服務通信,但越來越以下錯誤:CORS問題與RestyGWT客戶端在JBoss遠程服務AS 7
OPTIONS http://localhost:8080/remoteService No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8888' is therefore not allowed access.
VM482:81
XMLHttpRequest cannot load http://localhost:8080/remoteService No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8888' is therefore not allowed access.
我已經啓用以下通過@OPTIONS頭和訪問控制在後端服務器爲:
"Access-Control-Allow-Origin", "*"
"Access-Control-Allow-Methods", "POST, GET, UPDATE, DELETE, OPTIONS"
"Access-Control-Allow-Headers", "content-type,x-http-method-override"
我的客戶接口與服務器進行通信是:
@Path("/remoteService")
public interface MonitorMeService extends RestService {
@Path(value="/getBooks")
@GET
@Consumes(MediaType.APPLICATION_JSON)
void getBooks(MethodCallback<List<Books>> callback);
}
任何人都可以請告訴我失蹤?我錯過了哪些CORS處理?
「Access-Control-Allow-Origin」,「*」 「Access-Control-Allow-Methods」,「POST,GET,UPDATE,DELETE,OPTIONS」 「Access-Control-頭文件「,」content-type,x-http-method-override「,但仍然會出現相同的錯誤。 –
對於非OPTIONS方法,使用'Access-Control-Allow-Origin'標頭就足夠了。編輯我的回覆建議過濾器。 –