Package org.apache.http.entity.mime

Examples of org.apache.http.entity.mime.MultipartEntity.addPart()


    public void testNonRepeatable() throws Exception {
        MultipartEntity entity = new MultipartEntity();
        entity.addPart("p1", new InputStreamBody(
                new ByteArrayInputStream("blah blah".getBytes()), null));
        entity.addPart("p2", new InputStreamBody(
                new ByteArrayInputStream("yada yada".getBytes()), null));
        assertFalse(entity.isRepeatable());
        assertTrue(entity.isChunked());
        assertTrue(entity.isStreaming());
View Full Code Here


         
          Map<String, String> postMap = request.getPostMap();
          for (String key : postMap.keySet()) {
            String value = postMap.get(key);
            value = value==null ? "" : value;
            entity.addPart(key, new StringBody(value, Charset.forName(charset)));
          }
         
          Map<String, File> fileMap = request.getFileMap();
          for (String key : fileMap.keySet()) {
            File value = fileMap.get(key);
View Full Code Here

          }
         
          Map<String, File> fileMap = request.getFileMap();
          for (String key : fileMap.keySet()) {
            File value = fileMap.get(key);
            entity.addPart(new FormBodyPart(key, new FileBody(value, getMimeType(value))));
          }
          httppost.setEntity(entity);
        } else if(request.getPostMap().size() > 0) {
          List<NameValuePair>list=new ArrayList<NameValuePair>();
         
View Full Code Here

      request = new HttpGet(url);
    }
    else if(method.equals("POST"))
    {
      MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
      entity.addPart("text", new StringBody(body));

      request = new HttpPost(url);

      ((HttpPost) request).setEntity(entity);
    }
View Full Code Here

   */
  private MultipartEntity getInterfaceData(WeiBoDelParamBean paramBean) throws UnsupportedEncodingException {
    MultipartEntity reqEntity = new MultipartEntity();
   
    // AccessToken
    reqEntity.addPart("access_token", new StringBody(paramBean
        .getAccessToken()));

    // AppId
    reqEntity.addPart("oauth_consumer_key", new StringBody(oqu.getConfigValue("qq.appid")));

View Full Code Here

    // AccessToken
    reqEntity.addPart("access_token", new StringBody(paramBean
        .getAccessToken()));

    // AppId
    reqEntity.addPart("oauth_consumer_key", new StringBody(oqu.getConfigValue("qq.appid")));

    // Openid
    reqEntity.addPart("openid", new StringBody(paramBean.getOpenId()));

    // 定义API返回的数据格式
View Full Code Here

    // AppId
    reqEntity.addPart("oauth_consumer_key", new StringBody(oqu.getConfigValue("qq.appid")));

    // Openid
    reqEntity.addPart("openid", new StringBody(paramBean.getOpenId()));

    // 定义API返回的数据格式
    reqEntity.addPart("format", new StringBody("json"));
   
    // 微博消息的ID
View Full Code Here

    // Openid
    reqEntity.addPart("openid", new StringBody(paramBean.getOpenId()));

    // 定义API返回的数据格式
    reqEntity.addPart("format", new StringBody("json"));
   
    // 微博消息的ID
    reqEntity.addPart("id", new StringBody(paramBean.getId()));
   
    return reqEntity;
View Full Code Here

    // 定义API返回的数据格式
    reqEntity.addPart("format", new StringBody("json"));
   
    // 微博消息的ID
    reqEntity.addPart("id", new StringBody(paramBean.getId()));
   
    return reqEntity;
  }
 
 
View Full Code Here

   * @throws UnsupportedEncodingException
   */
  private MultipartEntity getAddTopicParam(QqAddTopicParamBean addTopicBean) throws UnsupportedEncodingException {
    MultipartEntity reqEntity = new MultipartEntity();
    // AccessToken
    reqEntity.addPart("access_token", new StringBody(addTopicBean
        .getAccessToken()));
   
    // AppId
    reqEntity.addPart("oauth_consumer_key", new StringBody(oqu.getConfigValue("qq.appid")));
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.