1

I have been trying to send a POST request from a servlet and the code that I wrote is this:

HttpPost post = new HttpPost(url.build());
post.setEntity(new UrlEncodedFormEntity(nameValue));
post.setHeader("content-type", "application/json");
HttpClient client = new DefaultHttpClient();
HttpResponse res = client.execute(post);

The URL is "https://accounts.google.com/o/oauth2/token" and I send some parameters with this request.

However, when I run this I get AccessControlException.

The HttpPost method that I use here comes from org.apache.http i.e., commons HttpClient API. I have tried a lot but it doesn't seem to work.

So the question is "Is it possible to send a cross domain request using HttpClient?"

yatskevich
  • 2,085
  • 16
  • 25
user1540439
  • 21
  • 1
  • 4
  • 1
    I don't know if it's still relevant, but I more or less copy-pasted this code and it worked. Could you please elaborate? What parameters are you sending? – Ido Cohn Jul 14 '13 at 17:55

0 Answers0