Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpMethodBase.addRequestHeader()


    String etag = head.getValue();

    // If-None-Match tests
    // we set a non matching ETag
    get = getSelectMethod(method);
    get.addRequestHeader("If-None-Match", "\"xyz123456\"");
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals(
        "If-None-Match: Got no response code 200 in response to non matching ETag",
        200, get.getStatusCode());
View Full Code Here


        "If-None-Match: Got no response code 200 in response to non matching ETag",
        200, get.getStatusCode());

    // now we set matching ETags
    get = getSelectMethod(method);
    get.addRequestHeader("If-None-Match", "\"xyz1223\"");
    get.addRequestHeader("If-None-Match", "\"1231323423\", \"1211211\",   "
        + etag);
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-None-Match: Got no response 304 to matching ETag", 304,
View Full Code Here

        200, get.getStatusCode());

    // now we set matching ETags
    get = getSelectMethod(method);
    get.addRequestHeader("If-None-Match", "\"xyz1223\"");
    get.addRequestHeader("If-None-Match", "\"1231323423\", \"1211211\",   "
        + etag);
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-None-Match: Got no response 304 to matching ETag", 304,
        get.getStatusCode());
View Full Code Here

    assertEquals("If-None-Match: Got no response 304 to matching ETag", 304,
        get.getStatusCode());

    // we now set the special star ETag
    get = getSelectMethod(method);
    get.addRequestHeader("If-None-Match", "*");
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-None-Match: Got no response 304 for star ETag", 304, get
        .getStatusCode());

View Full Code Here

        .getStatusCode());

    // If-Match tests
    // we set a non matching ETag
    get = getSelectMethod(method);
    get.addRequestHeader("If-Match", "\"xyz123456\"");
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals(
        "If-Match: Got no response code 412 in response to non matching ETag",
        412, get.getStatusCode());
View Full Code Here

        "If-Match: Got no response code 412 in response to non matching ETag",
        412, get.getStatusCode());

    // now we set matching ETags
    get = getSelectMethod(method);
    get.addRequestHeader("If-Match", "\"xyz1223\"");
    get.addRequestHeader("If-Match", "\"1231323423\", \"1211211\",   " + etag);
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-Match: Got no response 200 to matching ETag", 200, get
        .getStatusCode());
View Full Code Here

        412, get.getStatusCode());

    // now we set matching ETags
    get = getSelectMethod(method);
    get.addRequestHeader("If-Match", "\"xyz1223\"");
    get.addRequestHeader("If-Match", "\"1231323423\", \"1211211\",   " + etag);
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-Match: Got no response 200 to matching ETag", 200, get
        .getStatusCode());
View Full Code Here

    assertEquals("If-Match: Got no response 200 to matching ETag", 200, get
        .getStatusCode());

    // now we set the special star ETag
    get = getSelectMethod(method);
    get.addRequestHeader("If-Match", "*");
    getClient().executeMethod(get);
    checkResponseBody(method, get);
    assertEquals("If-Match: Got no response 200 to star ETag", 200, get
        .getStatusCode());
  }
View Full Code Here

      // initialize the connection settings
      client.getHttpConnectionManager().getParams()
          .setConnectionTimeout(CONNECTION_TIMEOUT);
      client.getParams().setBooleanParameter(
          HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, true);
      httpMethodBase.addRequestHeader("accept", "*/*");
      httpMethodBase.addRequestHeader("accept-language", "en-us");
      httpMethodBase.addRequestHeader("user-agent", userAgent);

      if (forwardCookie) {
        // get cookies from request
View Full Code Here

      client.getHttpConnectionManager().getParams()
          .setConnectionTimeout(CONNECTION_TIMEOUT);
      client.getParams().setBooleanParameter(
          HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, true);
      httpMethodBase.addRequestHeader("accept", "*/*");
      httpMethodBase.addRequestHeader("accept-language", "en-us");
      httpMethodBase.addRequestHeader("user-agent", userAgent);

      if (forwardCookie) {
        // get cookies from request
        Cookie[] cookies = request.getCookies();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.