Skip to content

Instantly share code, notes, and snippets.

@mess110
Created May 4, 2012 13:15
Show Gist options
  • Save mess110/2594737 to your computer and use it in GitHub Desktop.
Save mess110/2594737 to your computer and use it in GitHub Desktop.
public static HttpResponse doPut(String url, JSONObject c) throws Exception
{
HttpClient httpclient = new DefaultHttpClient();
HttpPut request = new HttpPut(url);
StringEntity s = new StringEntity(c.toString());
s.setContentEncoding("UTF-8");
s.setContentType("application/json");
request.setEntity(s);
request.addHeader("accept", "application/json");
return httpclient.execute(request);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment