Package org.apache.commons.httpclient.params

Examples of org.apache.commons.httpclient.params.HttpMethodParams


    checkNotNull(processor);

    final M method = processor.createMethod(uri.toString());

    //retry policy
    HttpMethodParams methodParams = method.getParams();
    methodParams.setParameter(HttpMethodParams.RETRY_HANDLER,
            new DefaultHttpMethodRetryHandler(
                    retryCount, false));
    methodParams.setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT,
                                 connectTimeout);
    methodParams.setSoTimeout(socketTimeout);
    method.addRequestHeader(HEADER_USER_AGENT, SWIFT_USER_AGENT);
    Duration duration = new Duration();
    boolean success = false;
    try {
      int statusCode = 0;
View Full Code Here


        getResponseTrailerHeaderGroup().clear();
        statusLine = null;
        effectiveVersion = null;
        aborted = false;
        used = false;
        params = new HttpMethodParams();
        responseBody = null;
        recoverableExceptionCount = 0;
        connectionCloseForced = false;
        hostAuthState.invalidate();
        proxyAuthState.invalidate();
View Full Code Here

            {
                throw new TransformerException(HttpMessages.unsupportedMethod(method));
            }

            // Allow the user to set HttpMethodParams as an object on the message
            final HttpMethodParams params = (HttpMethodParams) msg.removeProperty(
                HttpConnector.HTTP_PARAMS_PROPERTY, PropertyScope.OUTBOUND);
            if (params != null)
            {
                httpMethod.setParams(params);
            }
View Full Code Here

   */
  @SuppressWarnings("deprecation")
  private void doPost(PostMethod method, RequestEntity data, String dest)
      throws IOException, HttpException {

    HttpMethodParams pars = method.getParams();
    pars.setParameter(HttpMethodParams.RETRY_HANDLER,
        (Object) new HttpMethodRetryHandler() {
          public boolean retryMethod(HttpMethod m, IOException e, int exec) {
            return !(e instanceof java.net.ConnectException)
                && (exec < MAX_RETRIES_PER_COLLECTOR);
          }
        });

    pars.setParameter(HttpMethodParams.SO_TIMEOUT, new Integer(30000));

    method.setParams(pars);
    method.setPath(dest);

    // send it across the network
View Full Code Here

            method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
                    HTTPConstants.COMPRESSION_GZIP);
        }
       
        if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
            HttpMethodParams params = (HttpMethodParams)msgContext
                    .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
            method.setParams(params);
        }

        String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
View Full Code Here

   * @param dest the URL being requested. (Including hostname)
   */
  protected List<String> doRequest(HttpMethodBase method, String dest)
      throws IOException, HttpException {

    HttpMethodParams pars = method.getParams();
    pars.setParameter(HttpMethodParams.RETRY_HANDLER,
        (Object) new HttpMethodRetryHandler() {
          public boolean retryMethod(HttpMethod m, IOException e, int exec) {
            return !(e instanceof java.net.ConnectException)
                && (exec < MAX_RETRIES_PER_COLLECTOR);
          }
        });

    pars.setParameter(HttpMethodParams.SO_TIMEOUT, new Integer(COLLECTOR_TIMEOUT));

    method.setParams(pars);
    method.setPath(dest);

    // Send POST request
View Full Code Here

   * @param dest the URL being requested. (Including hostname)
   */
  protected List<String> doRequest(HttpMethodBase method, String dest)
      throws IOException, HttpException {

    HttpMethodParams pars = method.getParams();
    pars.setParameter(HttpMethodParams.RETRY_HANDLER,
        (Object) new HttpMethodRetryHandler() {
          public boolean retryMethod(HttpMethod m, IOException e, int exec) {
            return !(e instanceof java.net.ConnectException)
                && (exec < MAX_RETRIES_PER_COLLECTOR);
          }
        });

    pars.setParameter(HttpMethodParams.SO_TIMEOUT, new Integer(COLLECTOR_TIMEOUT));

    method.setParams(pars);
    method.setPath(dest);

    // Send POST request
View Full Code Here

         method.setContentChunked(true);
      } else {
         method = new PutMethod(url);
         method.addRequestHeader("Cookie", cookie);
         method.setContentChunked(false);
         HttpMethodParams params = new HttpMethodParams();
         params.setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true);
         method.setParams(params);
      }
      method.setRequestEntity(entity);

      logger.info("upload " + file + " to " + url);
View Full Code Here

        }
        // there's an HttpClient 3.0.1 bug setting Expect headers. See ExpectContinueMethod.addRequestHeaders. That method discards
        // all Expect headers if USE_EXPECT_CONTINUE is false on the parameters, so we'll have to send Expect:100-continue whenever we
        // send any other expect headers. Note that this has the virtuous side-effect of preserving the Expect: 100-continue header passed
        // into the ScspClient.
        HttpMethodParams params = method.getParams();
        params.setParameter(HttpClientParams.USE_EXPECT_CONTINUE, useExpectContinue);
        //params.setExpectContinueTimeout(30000);

        HttpMethod resMethod = addHeadersToMethod(method);
        if (this.streamLength > 32768) {
            // Another HttpClient 3.0.1 bug. The method writeRequest on HttpMethodBase makes the same mistake that
View Full Code Here

    log("POST" + url);
    PostMethod postMethod = new PostMethod(url);
    for (int i = 0; i < params.length; i++) {
      postMethod.addParameter(params[i].getName(), params[i].getValue());
    }
    HttpMethodParams param = postMethod.getParams();
    param.setContentCharset("UTF-8");
    if (WithTokenHeader) {
      return httpRequest(postMethod);
    } else {
      return httpRequest(postMethod, WithTokenHeader);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.params.HttpMethodParams

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.