Examples of MultipartEntity


Examples of ch.boye.httpclientandroidlib.entity.mime.MultipartEntity

          return null;
        }

        InputStreamBody isBody = new InputStreamBody(fileInputStream, mimeType, id);

        MultipartEntity reqEntity = new MultipartEntity();
        reqEntity.addPart("image", isBody);
        httppost.setEntity(reqEntity);
        HttpResponse response = null;

        try {
          response = mCachingHttpClient.execute(httppost, new BasicHttpContext());
View Full Code Here

Examples of ch.boye.httpclientandroidlib.entity.mime.MultipartEntity

        SurespotLog.v(TAG, "posting file stream");

        HttpPost httppost = new HttpPost(mBaseUrl + "/images/" + user + "/" + ourVersion);

        InputStreamBody isBody = new InputStreamBody(fileInputStream, SurespotConstants.MimeTypes.IMAGE, iv);
        MultipartEntity reqEntity = new MultipartEntity();
        reqEntity.addPart("image", isBody);
        httppost.setEntity(reqEntity);
        HttpResponse response = null;

        try {
          response = mCachingHttpClient.execute(httppost, new BasicHttpContext());
View Full Code Here

Examples of ch.boye.httpclientandroidlib.entity.mime.MultipartEntity

  }

  public Boolean addImageToAmen(Long amenId, File image) {

    MultipartEntity multipartEntity = new MultipartEntity();


    FileBody bin = new FileBody(image, "photo.jpg", "image/jpg", "UTF-8");
    multipartEntity.addPart("photo", bin);

    try {
      multipartEntity.addPart("amen_id", new StringBody("" + amenId));
      multipartEntity.addPart("auth_token", new StringBody(authToken));

    } catch (UnsupportedEncodingException e) {

      throw new RuntimeException("Unsupported Encoding", e);
    }
View Full Code Here

Examples of com.android.internal.http.multipart.MultipartEntity

            Part[] parts = {
                    new StringPart("device_id", deviceId),
                    new StringPart("timestamp", timestamp),
                    new FilePart("file", file)
            };
            MultipartEntity reqEntity = new MultipartEntity(parts, postRequest.getParams());
            postRequest.setEntity(reqEntity);
            HttpResponse res = httpClient.execute(postRequest);
            res.getEntity().getContent().close();
        } catch (IOException e) {
            Log.e(LOG_TAG, "Could not upload file with error: " + e);
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

      // Setup request using POST stream with URL and data
      HttpPost httppost = new HttpPost(buildWebUIUrl() + requestUrl);
      if (upload != null) {
        Part[] parts = { new FilePart(BT_ADD_BY_FILE, upload) };
        httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));
      }

      // Send the stored session token as a header
      if (sessionToken != null) {
        httppost.addHeader(SESSION_HEADER, sessionToken);
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

     
        // Setup request using POST
        HttpPost httppost = new HttpPost(buildWebUIUrl(path));
        File upload = new File(URI.create(file));
        Part[] parts = { new BitCometFilePart("torrent_file", upload), new Utf8StringPart("save_path", defaultPath) };
        httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));
       
        // Make the request
        response = httpclient.execute(httppost);
       
        entity = response.getEntity();
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

      // Setup request using POST
      HttpPost httppost = new HttpPost(buildWebUIUrl(path));
      File upload = new File(URI.create(file));
      Part[] parts = { new FilePart("torrentfile", upload) };
      httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));
      return makeWebRequest(path, httppost);

    } catch (FileNotFoundException e) {
      throw new DaemonException(ExceptionType.FileAccessError, e.toString());
    }
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

      // Setup request using POST
      HttpPost httppost = new HttpPost(buildWebUIUrl(path));
      File upload = new File(URI.create(file));
      Part[] parts = { new FilePart("fileEl", upload) };
      httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));

      // Make the request
      HttpResponse response = httpclient.execute(httppost);
      return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

    // Setup client using POST
    HttpPost httppost = new HttpPost(url);
    File upload = new File(URI.create(file));
    Part[] parts = { new FilePart(RPC_FILE, upload) };
    httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));

    // Make request
    HttpResponse response = httpclient.execute(httppost);

    // Read JSON response
View Full Code Here

Examples of com.android.internalcopy.http.multipart.MultipartEntity

      // Make request
      HttpPost httppost = new HttpPost(buildWebUIUrl(RPC_URL_DISPATCH + action + RPC_URL_DISPATCH2 + RPC_URL_AID));

      File upload = new File(URI.create(target));
      Part[] parts = { new FilePart("upload_files[]", upload) };
      httppost.setEntity(new MultipartEntity(parts, httppost.getParams()));
      HttpResponse response = httpclient.execute(httppost);

      // Read response (a successful action always returned '1')
      InputStream instream = response.getEntity().getContent();
      String result = HttpHelper.convertStreamToString(instream);
View Full Code Here
TOP
Copyright © 2015 www.androidadb.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.