Android Open Source - FrameLite Http String Post Request






From Project

Back to project page FrameLite.

License

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.

Java Source Code

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;
  }

}




Java Source Code List

com.miku.framelite.FrameApplication.java
com.miku.framelite.FrameBaseActivity.java
com.miku.framelite.FrameOrmBaseActivity.java
com.miku.framelite.adapter.FrameBaseAdapter.java
com.miku.framelite.annotations.ViewInject.java
com.miku.framelite.api.BaseRequest.java
com.miku.framelite.api.IRequest.java
com.miku.framelite.api.RetResult.java
com.miku.framelite.api.core.Executor.java
com.miku.framelite.api.database.AbstractDatabaseRequest.java
com.miku.framelite.api.database.AbstractOrmDatabaseRequest.java
com.miku.framelite.api.database.DatabaseQueryRequest.java
com.miku.framelite.api.database.DatabaseType.java
com.miku.framelite.api.http.AbstractHttpRequest.java
com.miku.framelite.api.http.HttpStringGetRequest.java
com.miku.framelite.api.http.HttpStringPostRequest.java
com.miku.framelite.api.http.HttpType.java
com.miku.framelite.api.webservice.AbstractWebServiceRequest.java
com.miku.framelite.api.webservice.WebServiceConnectionSE.java
com.miku.framelite.api.webservice.WebServiceHttpTransportSE.java
com.miku.framelite.api.webservice.WebServiceJsonRequest.java
com.miku.framelite.api.webservice.WebServiceStringRequest.java
com.miku.framelite.httpx.IDownloadHandler.java
com.miku.framelite.httpx.IHttpX.java
com.miku.framelite.httpx.core.DownloadHandler.java
com.miku.framelite.httpx.core.HttpX.java
com.miku.framelite.services.CrashHandler.java
com.miku.framelite.utils.BitmapUtils.java
com.miku.framelite.utils.DateUtils.java
com.miku.framelite.utils.DimensionUtils.java
com.miku.framelite.utils.EncryptionUtils.java
com.miku.framelite.utils.HttpUtils.java
com.miku.framelite.utils.Log.java
com.miku.framelite.utils.TelePhoneUtils.java
com.miku.framelite.utils.ViewUtils.java