@GeoffGenz && @BKM were right. CORS is to blame. I imagine there are several ways around the problem.
- During development, don't debug your page by loading it from file, instead deploy it, inside of your web server, and debug from there using firebugs. This was my case. I was loading the webpage from file:///...... and I was making a request to http://
localhost
... Because the protocol is different (file vs http) the request has different origin, as explained in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript . Once deployed in JBoss everything works. - A second solution, which I haven't try would be to use JSONP Angular
- The last one would be to create a ContainerResponseFilter to alter the headers?
@Provider public class RespFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext reqContext, ContainerResponseContext respContext) throws IOException { respContext.getHeaders().putSingle("Access-Control-Allow-Origin", "*"); } }