title: RESTful webservice : how to set headers in java to accept XMLHttpRequest allowed by Access-Control-Allow-Origin
body: <p>I have a RESTful webservice which will return string and it was written in Java (JAX-WS).
  My problem is when I send request to that webservice with URL like :</p>
  
  <p><code>http://localhost:8080/project/webservices/getlist/getListCustomers</code></p>
  
  <p>In the console it's giving me the error message below:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load url Origin localhost is not allowed 
        by Access-Control-Allow-Origin</p>
  </blockquote>
  
  <p>How can I handle this issue?</p>
  
  <p>Java code:</p>
  
  <pre><code>@GET
  @Path("/getsample")
  public Response getMsg() { 
      String output = "Jersey say : " ;   
      return Response.status(200).entity(output).build();
  }
  </code></pre>