diff --git a/library/build.gradle b/library/build.gradle index 7a819061..8ba4a691 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,7 +5,7 @@ apply plugin: "maven-publish" ext { - appCompatVersion="27.0.1" + appCompatVersion="27.0.2" } android @@ -17,8 +17,8 @@ android minSdkVersion 14 targetSdkVersion 27 - versionCode 21 - versionName "2.6.1" + versionCode 22 + versionName "2.7.0" } buildTypes @@ -128,9 +128,6 @@ publishing.publications.all bintray { - user = bintrayUsername - key = bintrayKey - publications = ["ReleasePublication"] pkg diff --git a/library/src/main/java/com/smartnsoft/droid4me/ws/URLConnectionWebServiceCaller.java b/library/src/main/java/com/smartnsoft/droid4me/ws/URLConnectionWebServiceCaller.java index e8471e41..bc6b07b9 100644 --- a/library/src/main/java/com/smartnsoft/droid4me/ws/URLConnectionWebServiceCaller.java +++ b/library/src/main/java/com/smartnsoft/droid4me/ws/URLConnectionWebServiceCaller.java @@ -197,6 +197,7 @@ protected int getConnectTimeout() * @param callType the type of the HTTP method * @param postParameters the body (as form-data fields) of the HTTP method when its a {@link CallType#Post} or a {@link CallType#Put} ; {@code null} * otherwise + * @param headers the original headers of the request. They can be edited in order to manage some scenarios with tokens * @param body the body (as form-data fields) of the HTTP method when its a {@link CallType#Post} or a {@link CallType#Put} ; {@code null} * otherwise * @param httpURLConnection the HttpURLConnection object @@ -206,7 +207,8 @@ protected int getConnectTimeout() * @return {@code true} if you want the request to be re-run if it has failed * @throws CallException if you want the call to be considered as not OK */ - protected boolean onStatusCodeNotOk(String uri, CallType callType, Map postParameters, String body, + protected boolean onStatusCodeNotOk(String uri, CallType callType, Map postParameters, + Map headers, String body, HttpURLConnection httpURLConnection, URL url, int statusCode, String statusMessage, int attemptsCount) throws CallException { @@ -472,7 +474,8 @@ protected HttpURLConnection performHttpRequest(String uri, CallType callType, Ma return performHttpRequest(uri, callType, headers, parameters, body, files, 0); } - protected boolean shouldTryToConsumeErrorInputstream(int statusCode, String uri, CallType callType, Map headers, + protected boolean shouldTryToConsumeErrorInputstream(int statusCode, String uri, CallType callType, + Map headers, Map parameters, String body, List files) { return false; @@ -733,7 +736,7 @@ else if (paramaters != null && paramaters.size() > 0) if (!(responseCode >= HttpURLConnection.HTTP_OK && responseCode < HttpURLConnection.HTTP_MULT_CHOICE)) { - if (onStatusCodeNotOk(uri, callType, paramaters, body, httpURLConnection, url, responseCode, responseMessage, + if (onStatusCodeNotOk(uri, callType, paramaters, headers, body, httpURLConnection, url, responseCode, responseMessage, attemptsCount + 1) == true) { return performHttpRequest(uri, callType, headers, paramaters, body, files, attemptsCount + 1); diff --git a/sample/build.gradle b/sample/build.gradle index e7628eef..ad4526f6 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -2,15 +2,14 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 - buildToolsVersion "26.0.2" + compileSdkVersion 27 defaultConfig { applicationId "com.smartnsoft.sample" minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" @@ -29,6 +28,6 @@ android dependencies { - implementation ("com.android.support:appcompat-v7:27.0.1") + implementation ("com.android.support:appcompat-v7:27.0.2") implementation (project(":library")) }