org.apache.http.client.RedirectHandler Java Examples

The following examples show how to use org.apache.http.client.RedirectHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockHttpClient.java    From google-http-java-client with Apache License 2.0 6 votes vote down vote up
@Override
protected RequestDirector createClientRequestDirector(
    HttpRequestExecutor requestExec,
    ClientConnectionManager conman,
    ConnectionReuseStrategy reustrat,
    ConnectionKeepAliveStrategy kastrat,
    HttpRoutePlanner rouplan,
    HttpProcessor httpProcessor,
    HttpRequestRetryHandler retryHandler,
    RedirectHandler redirectHandler,
    AuthenticationHandler targetAuthHandler,
    AuthenticationHandler proxyAuthHandler,
    UserTokenHandler stateHandler,
    HttpParams params) {
  return new RequestDirector() {
    @Beta
    public HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context)
        throws HttpException, IOException {
      return new BasicHttpResponse(HttpVersion.HTTP_1_1, responseCode, null);
    }
  };
}
 
Example #2
Source File: LibHttpClient.java    From YiBo with Apache License 2.0 5 votes vote down vote up
@Override
protected RequestDirector createClientRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectHandler redirectHandler,
        final AuthenticationHandler targetAuthHandler,
        final AuthenticationHandler proxyAuthHandler,
        final UserTokenHandler stateHandler,
        final HttpParams params) {
    return new LibRequestDirector(
            requestExec,
            conman,
            reustrat,
            kastrat,
            rouplan,
            httpProcessor,
            retryHandler,
            redirectHandler,
            targetAuthHandler,
            proxyAuthHandler,
            stateHandler,
            params);
}
 
Example #3
Source File: AsyncHttpClient.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public void setRedirectHandler(RedirectHandler redirecthandler)
{
    c.setRedirectHandler(redirecthandler);
}
 
Example #4
Source File: LibRequestDirector.java    From YiBo with Apache License 2.0 4 votes vote down vote up
public LibRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectHandler redirectHandler,
        final AuthenticationHandler targetAuthHandler,
        final AuthenticationHandler proxyAuthHandler,
        final UserTokenHandler userTokenHandler,
        final HttpParams params) {

    if (requestExec == null) {
        throw new IllegalArgumentException("Request executor may not be null.");
    }
    if (conman == null) {
        throw new IllegalArgumentException("Client connection manager may not be null.");
    }
    if (reustrat == null) {
        throw new IllegalArgumentException("Connection reuse strategy may not be null.");
    }
    if (kastrat == null) {
        throw new IllegalArgumentException("Connection keep alive strategy may not be null.");
    }
    if (rouplan == null) {
        throw new IllegalArgumentException("Route planner may not be null.");
    }
    if (httpProcessor == null) {
        throw new IllegalArgumentException("HTTP protocol processor may not be null.");
    }
    if (retryHandler == null) {
        throw new IllegalArgumentException("HTTP request retry handler may not be null.");
    }
    if (redirectHandler == null) {
        throw new IllegalArgumentException("Redirect handler may not be null.");
    }
    if (targetAuthHandler == null) {
        throw new IllegalArgumentException("Target authentication handler may not be null.");
    }
    if (proxyAuthHandler == null) {
        throw new IllegalArgumentException("Proxy authentication handler may not be null.");
    }
    if (userTokenHandler == null) {
        throw new IllegalArgumentException("User token handler may not be null.");
    }
    if (params == null) {
        throw new IllegalArgumentException("HTTP parameters may not be null");
    }
    this.requestExec       = requestExec;
    this.connManager       = conman;
    this.reuseStrategy     = reustrat;
    this.keepAliveStrategy = kastrat;
    this.routePlanner      = rouplan;
    this.httpProcessor     = httpProcessor;
    this.retryHandler      = retryHandler;
    this.redirectHandler   = redirectHandler;
    this.targetAuthHandler = targetAuthHandler;
    this.proxyAuthHandler  = proxyAuthHandler;
    this.userTokenHandler  = userTokenHandler;
    this.params            = params;

    this.managedConn       = null;

    this.execCount = 0;
    this.redirectCount = 0;
    this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100);
    this.targetAuthState = new AuthState();
    this.proxyAuthState = new AuthState();
}
 
Example #5
Source File: AsyncHttpClient.java    From Mobike with Apache License 2.0 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default provided doesn't suit
 * your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}
 
Example #6
Source File: AsyncHttpClient.java    From AndroidWear-OpenWear with MIT License 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default
 * provided doesn't suit your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see cn.openwatch.internal.http.loopj.MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}
 
Example #7
Source File: AsyncHttpClient.java    From android-project-wo2b with Apache License 2.0 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default provided doesn't suit
 * your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see com.wo2b.sdk.common.util.http.MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}
 
Example #8
Source File: AsyncHttpClient.java    From Android-Basics-Codes with Artistic License 2.0 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default provided doesn't suit
 * your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see com.loopj.android.http.MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}
 
Example #9
Source File: AsyncHttpClient.java    From Android-Basics-Codes with Artistic License 2.0 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default provided doesn't suit
 * your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see com.loopj.android.http.MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}
 
Example #10
Source File: AsyncHttpClient.java    From Android-Basics-Codes with Artistic License 2.0 2 votes vote down vote up
/**
 * Allows you to set custom RedirectHandler implementation, if the default provided doesn't suit
 * your needs
 *
 * @param customRedirectHandler RedirectHandler instance
 * @see com.loopj.android.http.MyRedirectHandler
 */
public void setRedirectHandler(final RedirectHandler customRedirectHandler) {
    httpClient.setRedirectHandler(customRedirectHandler);
}