Back to project page FrameLite.
The source code is released under:
GNU General Public License
If you think the Android project FrameLite 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 com.miku.framelite.api.http; /*from w ww . java2 s. c o m*/ import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.protocol.HTTP; import org.apache.http.util.EntityUtils; /** * Http Post?? * ???????getUrl()??? * ????????????????getBody()?getParams()???? * * @author xr.lee * * @param <T> ??????????? */ public abstract class HttpStringPostRequest<T> extends AbstractHttpRequest<T, String> { @Override protected HttpType getHttpType() { return HttpType.POST; } @Override protected abstract String getUrl(); @Override protected HttpEntity getBody() { List<NameValuePair> params=getParams(); if(params!=null){ try { return new UrlEncodedFormEntity(params, HTTP.UTF_8); } catch (Exception e) { e.printStackTrace(); } } return null; } protected List<NameValuePair> getParams(){ return null; } @Override protected String handleRawContent(HttpEntity rawHttpEntity) throws Exception { String ret=null; ret = EntityUtils.toString(rawHttpEntity); if (ret != null) { rawHttpEntity.consumeContent(); } return ret; } }