Code example for HttpUriRequest

Methods: abort

1
	} 
 
	public static HttpResponse save(HttpClient httpclient, String json) throws ClientProtocolException, IOException {
		StringEntity reqEntity = createEntity(json);
		HttpUriRequest post = createPost(DataController.DB_SERVER, reqEntity);
	    HttpResponse res = httpclient.execute( post, new BasicHttpContext() ); 
	    validateResponse(res, json);
	    post.abort();
	    return res;
	} 
 
	private static HttpUriRequest createPost(String url, StringEntity reqEntity) {
		HttpPost request = new HttpPost( url );
		request.setEntity(reqEntity);
		return request;
	} 
 
	private static StringEntity createEntity(String json) throws UnsupportedEncodingException {
		String encodedJson = new String(json.getBytes("ISO-8859-1"), "UTF-8");
		StringEntity reqEntity = new StringEntity(encodedJson);
		//Widerøe problem