Code example for StringEntity

Methods: setContentEncoding, writeTo

0
			conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
			conn.setRequestProperty("Accept", "application/json");
			conn.setRequestMethod("POST");
			conn.connect();
			OutputStream out = conn.getOutputStream();
			StringEntity se = new StringEntity(outboundJStr);
			se.setContentEncoding(
					new BasicHeader(HTTP.CONTENT_TYPE, 
							"application/json;charset=UTF-8")); 
			se.writeTo(out);
			out.flush();
			out.close();
			outboundJStr = null;
			 
			// It seems like getting the response code ensures that the  
			// data is transferred. It's also just a good idea to check  
			// it. 
			 
			// TODO return as string or int?? 
			status = conn.getResponseCode();