I was trying to add some headers to allow for CORS, it worked pretty well before, but this time it gives me an Restlet1001 connector error with the identical code
Form responseHeaders = addHeader((Form) getResponse().getAttributes().get("org.restlet.http.headers"));
if (responseHeaders != null){
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
so this is the code that calls the add header method, the add header method is:
public static Form addHeader(Form responseHeaders){
if (responseHeaders == null) {
responseHeaders = new Form();
responseHeaders.add("Access-Control-Allow-Origin", "*");
responseHeaders.add("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS");
responseHeaders.add("Access-Control-Allow-Headers", "Content-Type");
responseHeaders.add("Access-Control-Allow-Headers", "authCode");
responseHeaders.add("Access-Control-Allow-Headers", "origin, x-requested-with, content-type");
return responseHeaders;
}
return null;
}
After quite some try&error and Google, I still have no idea why it gives me:
2013-07-07 19:39:24 127.0.0.1 - - 8015 GET /api/v1.0/users/findSession - 200 - 0 159 http://localhost:8015 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36 -
2013-07-07 19:39:24 127.0.0.1 - - 8015 GET /api/v1.0/users/findSession - 1001 - 0 1 http://localhost:8015 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36 -
2013-07-07 19:39:24 127.0.0.1 - - 8015 GET /api/v1.0/users/findSession - 1001 - 0 1 http://localhost:8015 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36 -