Code example for HttpEntityEnclosingRequestBase

Methods: setEntity

0
		parts.add(new FilePart(name, new ByteArrayPartSource("blob", blob)));
	} 
	 
	/// set multipart entity 
	static void setMultipartEntity(HttpEntityEnclosingRequestBase request, List<Part> parts) {
		request.setEntity(new MultipartEntity(parts.toArray(new Part[parts.size()])));
	} 
	 
	/// set a http url encoded entity for post method 
	static void setUrlEncodedEntity(HttpEntityEnclosingRequestBase request, List<NameValuePair> pairs) {
		try { 
	        request.setEntity(new UrlEncodedFormEntity(pairs, "utf-8"));
        } catch (UnsupportedEncodingException e) {
        } 
	} 
	 
	/// add name value pair 
	static void addNameValuePair(List<NameValuePair> pairs, String name, String value) {
		pairs.add(new BasicNameValuePair(name, value));
	} 
Experience pair programming with AI  Get Codota for Java