diff options
Diffstat (limited to 'src/org/apache/http/impl/client/DefaultRequestDirector.java')
-rw-r--r-- | src/org/apache/http/impl/client/DefaultRequestDirector.java | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/org/apache/http/impl/client/DefaultRequestDirector.java b/src/org/apache/http/impl/client/DefaultRequestDirector.java index 50c4a3f..44d90e4 100644 --- a/src/org/apache/http/impl/client/DefaultRequestDirector.java +++ b/src/org/apache/http/impl/client/DefaultRequestDirector.java @@ -134,19 +134,14 @@ public class DefaultRequestDirector implements RequestDirector { /** The HTTP protocol processor. */ protected final HttpProcessor httpProcessor; - /** The request retry handler. */ protected final HttpRequestRetryHandler retryHandler; - /** The redirect handler. */ protected final RedirectHandler redirectHandler; - /** The target authentication handler. */ private final AuthenticationHandler targetAuthHandler; - /** The proxy authentication handler. */ private final AuthenticationHandler proxyAuthHandler; - /** The user token handler. */ private final UserTokenHandler userTokenHandler; @@ -919,22 +914,33 @@ public class DefaultRequestDirector implements RequestDirector { HttpResponse response, HttpContext context) throws HttpException, IOException { - HttpRoute route = roureq.getRoute(); HttpHost proxy = route.getProxyHost(); RequestWrapper request = roureq.getRequest(); - + HttpParams params = request.getParams(); - if (HttpClientParams.isRedirecting(params) && + if (HttpClientParams.isRedirecting(params) && this.redirectHandler.isRedirectRequested(response, context)) { - if (redirectCount >= maxRedirects) { throw new RedirectException("Maximum redirects (" + maxRedirects + ") exceeded"); } redirectCount++; - URI uri = this.redirectHandler.getLocationURI(response, context); + /* + * When SIM reaches zero balance all http traffic gets redirected + * to recharge url and all traffic need to be blocked. + * So redirect count is maintained. + * If feature is disabled or data traffic is already blocked + * no need to check for redirection. + */ + if (ZeroBalanceHelperClass.getFeatureFlagValue() && + (!ZeroBalanceHelperClass.getBackgroundDataProperty())) { + Header locationHeader = response.getFirstHeader("location"); + String location = locationHeader.getValue(); + ZeroBalanceHelperClass.setHttpRedirectCount(location); + this.log.error("zerobalance::Apachehttp:Redirect count set " ); + } HttpHost newTarget = new HttpHost( uri.getHost(), |