Android Open Source - Async-Http-lib-with-Parsing-for-Android Response Event Listener






From Project

Back to project page Async-Http-lib-with-Parsing-for-Android.

License

The source code is released under:

Apache License

If you think the Android project Async-Http-lib-with-Parsing-for-Android 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

/**
 * //from   w  w  w. j  a v a  2s.  c o m
 */
package com.cognizant.http.listeners;

import java.util.List;
import java.util.Map;

/**
 * 
 * This listener will response back with success, error or exception event based on 
 * success, error or find any exception while executing http/https calls.  
 * 
 * @author Ravi Bhojani
 *
 */
public interface ResponseEventListener {

  /**
   * If server responds with HTTP 200 status, parser will parse the success response and will send back to calling
   * function with parsed data.
   * @param data
   */
  public void onSuccess(Object data, Map<String, List<String>> responseHeader);
  
  /**
   * If server responds with HTTP not 200 status, which is error response,parser will parse the error response 
   * and will send back to calling function with parsed error data.
   * 
   * @param data
   */
  public void onError(Object data, int httpStatus, Map<String, List<String>> responseHeader);

  
  /**
   * 
   * While executing code, if there are any exception occurred, that exception will be send back to
   * calling function with the throwable of that exception. 
   * @param e
   */
  public void onException(Throwable e);
  
  /**
   * Before starting execution of HTTP in thread this method will be notified to calling function. This call runs in UI thread.
   * So calling functionality can perform UI operation before starting of HTTP thread.  
   */
  public void onPreExecute();
}




Java Source Code List

com.cognizant.http.HttpConnection.java
com.cognizant.http.HttpConstant.java
com.cognizant.http.Request.java
com.cognizant.http.ServiceBean.java
com.cognizant.http.ServiceCallAsyncTask.java
com.cognizant.http.ServiceCall.java
com.cognizant.http.jackson.JacksonObjectMapperHolder.java
com.cognizant.http.listeners.ResponseEventListener.java
com.cognizant.http.utils.HTTPUtil.java
com.cognizant.http.utils.NetworkAccessUtil.java
com.cognizant.http.utils.NoNetworkAvailableException.java