@Override public int executeMethod(HttpMethod method) throws IOException, HttpException { try { // just to log boolean customRedirectionNeeded = false; try { method.setFollowRedirects(mFollowRedirects); } catch (Exception e) { /* if (mFollowRedirects) Log_OC.d(TAG, "setFollowRedirects failed for " + method.getName() + " method, custom redirection will be used if needed"); */ customRedirectionNeeded = mFollowRedirects; } Log_OC.d( TAG + " #" + mInstanceNumber, "REQUEST " + method.getName() + " " + method.getPath()); // logCookiesAtRequest(method.getRequestHeaders(), "before"); // logCookiesAtState("before"); int status = super.executeMethod(method); if (customRedirectionNeeded) { status = patchRedirection(status, method); } // logCookiesAtRequest(method.getRequestHeaders(), "after"); // logCookiesAtState("after"); // logSetCookiesAtResponse(method.getResponseHeaders()); return status; } catch (IOException e) { Log_OC.d(TAG + " #" + mInstanceNumber, "Exception occured", e); throw e; } }