Android Open Source - AndroidUploader Http Bridge






From Project

Back to project page AndroidUploader.

License

The source code is released under:

Apache License

If you think the Android project AndroidUploader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package z.hol.uploader.bridge;
//from w ww  .j av a  2  s  .  c  o  m
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;

import java.io.IOException;

/**
 * Http?????.
 * ??????????httpClient,?httpPost.
 * ??????????? #fillEntry.
 * ??????? #execute
 * Created by holmes on 10/19/14.
 */
public class HttpBridge extends StreamBridge{

    private HttpPost mPost;
    private String mUrl;
    private HttpClient mClient;

    public HttpBridge(HttpClient client , HttpPost post){
        mClient = client;
        mPost = post;
    }

    public HttpBridge(HttpClient client, String url){
        mClient = client;
        mUrl = url;
        if (mUrl == null){
            throw new IllegalArgumentException("url should not be null.");
        }
        initHttpArgs();
    }

    public void initHttpArgs(){
        if (mPost == null){
            mPost = new HttpPost(mUrl);
        }
    }

    /**
     * ??????
     * @param entity
     */
    public void fillEntry(HttpEntity entity){
        mPost.setEntity(entity);
    }

    /**
     * ??
     * @throws IOException
     */
    public void execute() throws IOException {
        mClient.execute(mPost);
    }
}




Java Source Code List

z.hol.uploader.FileHttpUploader.java
z.hol.uploader.HttpUploader.java
z.hol.uploader.StreamUploader.java
z.hol.uploader.UploadStateCallback.java
z.hol.uploader.UploadUiHandler.java
z.hol.uploader.Uploader.java
z.hol.uploader.bridge.Bridge.java
z.hol.uploader.bridge.HttpBridge.java
z.hol.uploader.bridge.StreamBridge.java