Code example for HttpPost

Methods: setEntitygetParams

	public void deleteFavoriteFood(int id) throws OAuthMessageSignerException,
			OAuthExpectationFailedException, OAuthNotAuthorizedException, 
			ClientProtocolException, IOException { 
		// create a request that requires authentication 
		HttpPost post = new HttpPost(
		final List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		// 'status' here is the update value you collect from UI 
		nvps.add(new BasicNameValuePair("id", String.valueOf(id)));
		post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
		// set this to avoid 417 error (Expectation Failed) 
				CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
		// sign the request 
		// send the request 
		final HttpResponse response = client.execute(post);
		// response status should be 200 OK 
		int statusCode = response.getStatusLine().getStatusCode();
		final String reason = response.getStatusLine().getReasonPhrase();
		// release connection 
Contextual code suggestions in your IDE  Get Codota for Java