Code example for StringEntity

Methods: setContentType

0
 
	private HttpResponse executePutPost(HttpEntityEnclosingRequestBase request,
			String content, boolean useBackend) {
		try { 
			LOG.trace("Content: {}", content);
			StringEntity e = new StringEntity(content, "UTF-8");
			e.setContentType("application/json");
			request.setEntity(e);
			return executeRequest(request, useBackend);
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		} 
	} 
 
	private HttpResponse executeRequest(HttpRequestBase request, Map<String, String> headers) {
		for(Map.Entry<String, String> header : headers.entrySet()) {
			request.setHeader(header.getKey(), header.getValue());
		} 
		return executeRequest(request);
	} 
Connect your IDE to all the code out there  Get Codota for Java