List of usage examples for org.apache.http.protocol ExecutionContext HTTP_REQ_SENT
String HTTP_REQ_SENT
To view the source code for org.apache.http.protocol ExecutionContext HTTP_REQ_SENT.
Click Source Link
From source file:cn.edu.zzu.wemall.http.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from www. java 2 s.c o m*/ } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } String requestType = currentReq.getMethod(); retry = !requestType.equals("POST"); } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:cn.com.loopj.android.http.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from w w w . ja va 2 s. c om*/ } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:com.aoeng.degu.utils.net.asyncthhpclient.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*w ww. j av a2s. c o m*/ } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:cn.openwatch.internal.http.loopj.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/* w w w . j a v a2 s .c o m*/ } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { } return retry; }
From source file:com.vdisk.net.session.RetryHandler.java
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Log.d("Test", "retry count->" + executionCount); Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from ww w .j a va2 s. c o m*/ } else if (exceptionBlacklist.contains(exception.getClass())) { // immediately cancel retry if the error is blacklisted retry = false; } else if (exceptionWhitelist.contains(exception.getClass())) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); Log.d("Test", "HttpUriRequest:" + currentReq); if (currentReq != null) { String requestType = currentReq.getMethod(); retry = !requestType.equals("POST") && !requestType.equals("PUT"); } } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }
From source file:com.amytech.android.library.utils.asynchttp.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from w w w . java2 s. com*/ } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (!sent) { // for most other errors, retry only if request hasn't been fully // sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:com.enjoy.nerd.http.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;//ww w. j a va 2 s . co m } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully sent yet retry = true; } /* if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } */ if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:com.examination.afinal.http.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // ????????5 retry = false; } else if (exceptionBlacklist.contains(exception.getClass())) { // ???????? retry = false;/*from ww w .ja va2s . c o m*/ } else if (exceptionWhitelist.contains(exception.getClass())) { retry = true; } else if (!sent) { retry = true; } if (retry) { HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); retry = currentReq != null && !"POST".equals(currentReq.getMethod()); } if (retry) { //????? SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }
From source file:com.flyn.net.asynchttp.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { boolean retry = true; Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b); if (executionCount > maxRetries) { // Do not retry if over max retry count retry = false;/*from w ww . j a va 2 s. c o m*/ } else if (isInList(exceptionBlacklist, exception)) { // immediately cancel retry if the error is blacklisted retry = false; } else if (isInList(exceptionWhitelist, exception)) { // immediately retry if error is whitelisted retry = true; } else if (!sent) { // for most other errors, retry only if request hasn't been fully // sent yet retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); if (currentReq == null) { return false; } } if (retry) { SystemClock.sleep(retrySleepTimeMS); } else { exception.printStackTrace(); } return retry; }
From source file:com.louding.frame.http.download.RetryHandler.java
@Override public boolean retryRequest(IOException exception, int executionCount, HttpContext context) { // ??/* ww w .j a va 2s. c om*/ boolean retry = true; // ? Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT); boolean sent = (b != null && b.booleanValue()); if (executionCount > maxRetries) { // ???? retry = false; } else if (isInList(exceptionBlacklist, exception)) { // ?????? retry = false; } else if (isInList(exceptionWhitelist, exception)) { // ???? retry = true; } else if (!sent) { // ????? retry = true; } if (retry) { // resend all idempotent requests HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST); String requestType = currentReq.getMethod(); retry = !requestType.equals("POST"); } if (retry) { SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS); } else { exception.printStackTrace(); } return retry; }