Package org.apache.commons.httpclient.params

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


            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


  public static void configureHttpMethod(HttpMethod method, Target target) throws JSONException {
    method.addRequestHeader(new Header("Accept", "application/json"));
    method.addRequestHeader(new Header("Content-Type", "application/json"));
    //set default socket timeout for connection
    HttpMethodParams params = method.getParams();
    params.setSoTimeout(DEFAULT_SOCKET_TIMEOUT);
    method.setParams(params);
    if (target.getCloud().getAccessToken() != null)
      method.addRequestHeader(new Header("Authorization", "bearer " + target.getCloud().getAccessToken().getString("access_token")));
  }
View Full Code Here

  public static void configureHttpMethod(HttpMethod method, Cloud cloud) throws JSONException {
    method.addRequestHeader(new Header("Accept", "application/json"));
    method.addRequestHeader(new Header("Content-Type", "application/json"));
    //set default socket timeout for connection
    HttpMethodParams params = method.getParams();
    params.setSoTimeout(DEFAULT_SOCKET_TIMEOUT);
    method.setParams(params);
    if (cloud.getAccessToken() != null)
      method.addRequestHeader(new Header("Authorization", "bearer " + cloud.getAccessToken().getString("access_token")));
  }
View Full Code Here

    GetMethod method = new GetMethod();
    org.apache.commons.httpclient.URI uri = new org.apache.commons.httpclient.URI(uriString, true);
    method.setURI(uri);

    /* Set read timeout based on step level */
    HttpMethodParams params = new HttpMethodParams();
    params.setSoTimeout(task.getStep() == 0 ? 30 * 1000 : 15 * 1000);
    method.setParams(params);
   
    method.setRequestHeader(
        "Accept",
        "application/rdf+xml;q=1,"
View Full Code Here

    this.base = url.toString();
    this.orig = url.toString();
    GetMethod get = new GetMethod(this.orig);
    get.setFollowRedirects(followRedirects);
    get.setRequestHeader("User-Agent", http.getUserAgent());
    HttpMethodParams params = get.getParams();
    if (http.getUseHttp11()) {
      params.setVersion(HttpVersion.HTTP_1_1);
    } else {
      params.setVersion(HttpVersion.HTTP_1_0);
    }
    params.makeLenient();
    params.setContentCharset("UTF-8");
    params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
    // XXX (ab) not sure about this... the default is to retry 3 times; if
    // XXX the request body was sent the method is not retried, so there is
    // XXX little danger in retrying...
    // params.setParameter(HttpMethodParams.RETRY_HANDLER, null);
    try {
View Full Code Here

      get.setRequestHeader("If-Modified-Since",
          HttpDateFormat.toString(datum.getModifiedTime()));
    }

    // Set HTTP parameters
    HttpMethodParams params = get.getParams();
    if (http.getUseHttp11()) {
      params.setVersion(HttpVersion.HTTP_1_1);
    } else {
      params.setVersion(HttpVersion.HTTP_1_0);
    }
    params.makeLenient();
    params.setContentCharset("UTF-8");
    params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
    // XXX (ab) not sure about this... the default is to retry 3 times; if
    // XXX the request body was sent the method is not retried, so there is
    // XXX little danger in retrying...
    // params.setParameter(HttpMethodParams.RETRY_HANDLER, null);
    try {
View Full Code Here

    // To be avoided unless in debug mode
    Credentials defaultcreds = new UsernamePasswordCredentials("admin", "111111");
    client.getParams().setAuthenticationPreemptive(true);
    client.getState().setCredentials(AuthScope.ANY, defaultcreds);
    PutMethod method = new PutMethod("http://localhost:8080/agent/api/36");
    final HttpMethodParams params = new HttpMethodParams();
    params.setParameter("action", "approve");
    method.setParams(params);
    final int i = client.executeMethod(method);
    System.out.println(method.getResponseBodyAsString());
  }
View Full Code Here

      get.setRequestHeader("If-Modified-Since",
          HttpDateFormat.toString(datum.getModifiedTime()));
    }

    // Set HTTP parameters
    HttpMethodParams params = get.getParams();
    if (http.getUseHttp11()) {
      params.setVersion(HttpVersion.HTTP_1_1);
    } else {
      params.setVersion(HttpVersion.HTTP_1_0);
    }
    params.makeLenient();
    params.setContentCharset("UTF-8");
    params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
    // XXX (ab) not sure about this... the default is to retry 3 times; if
    // XXX the request body was sent the method is not retried, so there is
    // XXX little danger in retrying...
    // params.setParameter(HttpMethodParams.RETRY_HANDLER, null);
    try {
View Full Code Here

      get.setRequestHeader("If-Modified-Since",
          HttpDateFormat.toString(page.getModifiedTime()));
    }

    // Set HTTP parameters
    HttpMethodParams params = get.getParams();
    if (http.getUseHttp11()) {
      params.setVersion(HttpVersion.HTTP_1_1);
    } else {
      params.setVersion(HttpVersion.HTTP_1_0);
    }
    params.makeLenient();
    params.setContentCharset("UTF-8");
    params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    params.setBooleanParameter(HttpMethodParams.SINGLE_COOKIE_HEADER, true);
    // XXX (ab) not sure about this... the default is to retry 3 times; if
    // XXX the request body was sent the method is not retried, so there is
    // XXX little danger in retrying...
    // params.setParameter(HttpMethodParams.RETRY_HANDLER, null);
    try {
View Full Code Here

        HttpMethod method = createMethod(exchange);
        Message in = exchange.getIn();
        String httpProtocolVersion = in.getHeader(Exchange.HTTP_PROTOCOL_VERSION, String.class);
        if (httpProtocolVersion != null) {
            // set the HTTP protocol version
            HttpMethodParams params = method.getParams();
            params.setVersion(HttpVersion.parse(httpProtocolVersion));
        }

        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();

        // propagate headers as HTTP headers
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.