All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dg.libs.rest.requests.EntityHttpRequestImpl Maven / Gradle / Ivy

package com.dg.libs.rest.requests;

import org.apache.http.HttpEntity;

import android.content.Context;

import com.dg.libs.rest.callbacks.HttpCallback;
import com.dg.libs.rest.client.BaseRestClient.RequestMethod;
import com.dg.libs.rest.client.EntityBodyRestClient;
import com.dg.libs.rest.client.Rest;
import com.dg.libs.rest.parsers.HttpResponseParser;

public abstract class EntityHttpRequestImpl extends BaseHttpRequestImpl {

  public static final String TAG = EntityHttpRequestImpl.class.getSimpleName();
  protected final EntityBodyRestClient client;

  public EntityHttpRequestImpl(final Context context,
      RequestMethod requestMethod,
      final HttpResponseParser parser,
      final HttpCallback callback) {
    super(context, parser, callback);
    client = new EntityBodyRestClient();
    client.setRequestMethod(requestMethod);
  }

  @Override
  protected void doBeforeRunRequestInBackgroundThread() {
    super.doBeforeRunRequestInBackgroundThread();
    client.setEntity(getEntity());
  }

  public abstract HttpEntity getEntity();

  @Override
  public Rest getClient() {
    return client;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy