List of usage examples for org.apache.http.entity.mime.content StringBody StringBody
public StringBody(final String text) throws UnsupportedEncodingException
From source file:net.asplode.tumblr.LinkPost.java
/** * @param name Link name/*from ww w . j a va 2 s . c o m*/ * @throws UnsupportedEncodingException */ public void setName(String name) throws UnsupportedEncodingException { entity.addPart("name", new StringBody(name)); }
From source file:net.asplode.tumblr.TextPost.java
/** * @param body Post body//from w w w . j a v a2 s .co m * @throws UnsupportedEncodingException */ public void setBody(String body) throws UnsupportedEncodingException { entity.addPart("body", new StringBody(body)); }
From source file:net.asplode.tumblr.QuotePost.java
/** * @param source Quote source. Optional, HTML allowed. * @throws UnsupportedEncodingException/*from w w w.j a v a 2 s .c om*/ */ public void setSource(String source) throws UnsupportedEncodingException { entity.addPart("source", new StringBody(source)); }
From source file:net.asplode.tumblr.ConversationPost.java
/** * @param conversation Conversation/*from ww w. ja va2s . co m*/ * @throws UnsupportedEncodingException */ public void setConversation(String conversation) throws UnsupportedEncodingException { entity.addPart("conversation", new StringBody(conversation)); }
From source file:mobi.salesforce.client.upload.DemoFileUploader.java
public void executeMultiPartRequest(String urlString, File file, String fileName, String fileDescription) throws Exception { HttpClient client = new DefaultHttpClient(); HttpPost postRequest = new HttpPost(urlString); try {/*from w w w.ja v a 2 s . com*/ // Set various attributes MultipartEntity multiPartEntity = new MultipartEntity(); multiPartEntity.addPart("fileDescription", new StringBody(fileDescription != null ? fileDescription : "")); multiPartEntity.addPart("fileName", new StringBody(fileName != null ? fileName : file.getName())); FileBody fileBody = new FileBody(file, "application/octect-stream"); // Prepare payload multiPartEntity.addPart("attachment", fileBody); // Set to request body postRequest.setEntity(multiPartEntity); // Send request HttpResponse response = client.execute(postRequest); // Verify response if any if (response != null) { System.out.println(response.getStatusLine().getStatusCode()); } } catch (Exception ex) { } }
From source file:net.asplode.tumblr.PhotoPost.java
/** * @param url Click-through URL.//from w w w.ja v a 2s .c om * @throws UnsupportedEncodingException */ public void setClickThroughURL(String url) throws UnsupportedEncodingException { entity.addPart("click-through-url", new StringBody(url)); }
From source file:niclients.main.regni.java
static boolean createpub() throws UnsupportedEncodingException { post = new HttpPost(fqdn + "/.well-known/netinfproto/publish"); // -l int i = 0;/*w ww. j av a 2 s . com*/ StringBody url = new StringBody(niname); // -n reqEntity.addPart("URI", url); StringBody msgid = new StringBody(Integer.toString(randomGenerator.nextInt(100000000))); // generate reqEntity.addPart("msgid", msgid); for (i = 0; i < loc.size(); i++) { try { StringBody l = new StringBody(loc.get(i)); reqEntity.addPart("loc" + i, l); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } post.setEntity(reqEntity); return true; }
From source file:net.asplode.tumblr.LinkPost.java
/** * @param description Link description/*from w ww .ja va 2 s .c o m*/ * @throws UnsupportedEncodingException */ public void setDescription(String description) throws UnsupportedEncodingException { entity.addPart("description", new StringBody(description)); }
From source file:net.asplode.tumblr.ReblogPost.java
/** * @param reblogAs/*from ww w .ja v a 2s .com*/ * Optional type: "text", "link", "quote" * @throws UnsupportedEncodingException */ public void reblogAs(String reblogAs) throws UnsupportedEncodingException { entity.addPart("as", new StringBody(reblogAs)); }
From source file:net.asplode.tumblr.PhotoPost.java
/** * @param url Source URL of the image/* ww w . j av a2 s . c o m*/ * @throws UnsupportedEncodingException */ public void setSourceURL(String url) throws UnsupportedEncodingException { entity.addPart("source", new StringBody(url)); }