// Path: DrupalSDK/src/main/java/com/ls/http/base/ResponseData.java
// public class ResponseData {
// 	protected Object data;
// 	protected Map<String, String> headers;
// 	protected int statusCode;
// 	protected VolleyError error;
//     protected Object parsedErrorResponse;
// 
// 	
// 	/**	 
// 	 * @return Instance of class, specified in response or null if no such class was specified.
// 	 */
// 	public Object getData() {
// 		return data;
// 	}
// 
// 	public Map<String, String> getHeaders() {
// 		return headers;
// 	}
// 
// 	public int getStatusCode() {
// 		return statusCode;
// 	}
// 
// 	public VolleyError getError() {
// 		return error;
// 	}
// 
//     /**
//      *
//      * @return parsed error response is errorResponseSpecifier was provided and error received.
//      */
//     public Object getParsedErrorResponse() {
//         return parsedErrorResponse;
//     }
// 
//     public void cloneTo(ResponseData target)
//     {
//         target.data = data;
//         target.headers = headers;
//         target.statusCode = statusCode;
//         target.error = error;
//         target.parsedErrorResponse = parsedErrorResponse;
//     }
// 
// }
// 
// Path: DrupalSDK/src/main/java/com/ls/http/base/ResponseHandler.java
// public abstract class ResponseHandler
// {
//     protected abstract String getAcceptValueType();
// 
//     protected abstract Response<ResponseData> parseNetworkResponse(NetworkResponse response,Object responseClassSpecifier);
// }


import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.util.HashMap;
import com.android.volley.NetworkResponse;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.ls.http.base.ResponseData;
import com.ls.http.base.ResponseHandler;
import android.support.annotation.NonNull;
import android.text.TextUtils;
/*
 * The MIT License (MIT)
 *  Copyright (c) 2014 Lemberg Solutions Limited
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 *
 *    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *   SOFTWARE.
 */

package com.ls.http.base;





public abstract class BaseStringResponseHandler extends ResponseHandler
{
    protected abstract Object itemFromResponse(@NonNull String response, @NonNull Class<?> theClass);
    protected abstract Object itemFromResponse(@NonNull String response, @NonNull Type theType);

    protected Object itemFromResponseWithSpecifier(String response, Object theSpecifier)
	{
		Object result = null;
		if(response != null && theSpecifier != null)
		{
			if(theSpecifier instanceof Class<?>)
			{
                result = itemFromResponse(response, (Class<?>)theSpecifier);
// Path: DrupalSDK/src/main/java/com/ls/http/base/ResponseData.java
// public class ResponseData {
// 	protected Object data;
// 	protected Map<String, String> headers;
// 	protected int statusCode;
// 	protected VolleyError error;
//     protected Object parsedErrorResponse;
// 
// 	
// 	/**	 
// 	 * @return Instance of class, specified in response or null if no such class was specified.
// 	 */
// 	public Object getData() {
// 		return data;
// 	}
// 
// 	public Map<String, String> getHeaders() {
// 		return headers;
// 	}
// 
// 	public int getStatusCode() {
// 		return statusCode;
// 	}
// 
// 	public VolleyError getError() {
// 		return error;
// 	}
// 
//     /**
//      *
//      * @return parsed error response is errorResponseSpecifier was provided and error received.
//      */
//     public Object getParsedErrorResponse() {
//         return parsedErrorResponse;
//     }
// 
//     public void cloneTo(ResponseData target)
//     {
//         target.data = data;
//         target.headers = headers;
//         target.statusCode = statusCode;
//         target.error = error;
//         target.parsedErrorResponse = parsedErrorResponse;
//     }
// 
// }
// 
// Path: DrupalSDK/src/main/java/com/ls/http/base/ResponseHandler.java
// public abstract class ResponseHandler
// {
//     protected abstract String getAcceptValueType();
// 
//     protected abstract Response<ResponseData> parseNetworkResponse(NetworkResponse response,Object responseClassSpecifier);
// }


// Path: DrupalSDK/src/main/java/com/ls/http/base/BaseStringResponseHandler.java
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.util.HashMap;
import com.android.volley.NetworkResponse;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.ls.http.base.ResponseData;
import com.ls.http.base.ResponseHandler;
import android.support.annotation.NonNull;
import android.text.TextUtils;

/*
 * The MIT License (MIT)
 *  Copyright (c) 2014 Lemberg Solutions Limited
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 *
 *    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *   SOFTWARE.
 */

package com.ls.http.base;





public abstract class BaseStringResponseHandler extends ResponseHandler
{
    protected abstract Object itemFromResponse(@NonNull String response, @NonNull Class<?> theClass);
    protected abstract Object itemFromResponse(@NonNull String response, @NonNull Type theType);

    protected Object itemFromResponseWithSpecifier(String response, Object theSpecifier)
	{
		Object result = null;
		if(response != null && theSpecifier != null)
		{
			if(theSpecifier instanceof Class<?>)
			{
                result = itemFromResponse(response, (Class<?>)theSpecifier);
			}else if(theSpecifier instanceof Type){