我正在使用 RestyGWT 与 JBoss AS7 上的远程服务通信,但出现以下错误:
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 处理?