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

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

There is a newer version: 2.9.0
Show newest version
package com.dg.libs.rest.requests;

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;

import org.apache.http.HttpEntity;

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