Back to project page AndroidUploader.
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.
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); } }