Code example for HttpPut

Methods: setEntity, setHeader

0
	 
	@Override 
	public String put(String uri, String data) throws UnknownHostException {
		 
		// Prepare a request object 
		HttpPut httpPut = new HttpPut(uri);
		 
		try { 
			// The default http content charset is ISO-8859-1, JSON requires UTF-8 
			httpPut.setEntity(new StringEntity(data, "UTF-8"));
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
			return null; 
		} 
		 
		httpPut.setHeader("Content-Type", "application/json");
		sign(httpPut);
		 
		// Do not handle redirects, we need to sign the request again as the old signature will be invalid 
		HttpResponse response = execute(httpPut);
		return parseResponse(response);
	} 
	 
	public void saveConfiguration() {