コード例 #1
0
ファイル: HttpUtils.java プロジェクト: xuhongjia/XUtils
  public HttpHandler<File> download(
      HttpRequest.HttpMethod method,
      String url,
      String target,
      RequestParams params,
      boolean autoResume,
      boolean autoRename,
      RequestCallBack<File> callback) {

    if (url == null) throw new IllegalArgumentException("url may not be null");
    if (target == null) throw new IllegalArgumentException("target may not be null");

    HttpRequest request = new HttpRequest(method, url);

    HttpHandler<File> handler =
        new HttpHandler<File>(httpClient, httpContext, responseTextCharset, callback);

    handler.setExpiry(currentRequestExpiry);
    handler.setHttpRedirectHandler(httpRedirectHandler);

    if (params != null) {
      request.setRequestParams(params, handler);
      handler.setPriority(params.getPriority());
    }
    handler.executeOnExecutor(EXECUTOR, request, target, autoResume, autoRename);
    return handler;
  }
コード例 #2
0
ファイル: HttpUtils.java プロジェクト: SmallMaoBoy/monkey77
  private <T> HttpHandler<T> sendRequest(
      HttpRequest request, RequestParams params, RequestCallBack<T> callBack) {

    HttpHandler<T> handler =
        new HttpHandler<T>(httpClient, httpContext, responseTextCharset, callBack);

    handler.setExpiry(currentRequestExpiry);
    handler.setHttpRedirectHandler(httpRedirectHandler);
    request.setRequestParams(params, handler);

    handler.executeOnExecutor(executor, request);
    return handler;
  }
コード例 #3
0
ファイル: HttpUtils.java プロジェクト: xuhongjia/XUtils
  // //////////////////////////////////////////////////////////////////////////////////////////////
  private <T> HttpHandler<T> sendRequest(
      HttpRequest request, RequestParams params, RequestCallBack<T> callBack) {

    // liuzw. 增加安全加密步骤,加密过程可定制.
    if (secureInterceptor != null) {
      params = secureInterceptor.preSend(request, params);
    }

    HttpHandler<T> handler =
        new HttpHandler<T>(httpClient, httpContext, responseTextCharset, callBack);

    handler.setExpiry(currentRequestExpiry);
    handler.setHttpRedirectHandler(httpRedirectHandler);
    request.setRequestParams(params, handler);

    if (params != null) {
      handler.setPriority(params.getPriority());
    }
    handler.executeOnExecutor(EXECUTOR, request);
    return handler;
  }