Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpGet.removeHeaders()


        method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
        method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
        FilesResponse response = new FilesResponse(client.execute(method));
       
        if (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
          method.removeHeaders(FilesConstants.X_AUTH_TOKEN);
          if(login()) {
            method = new HttpGet(uri);
              method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
              method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
            response = new FilesResponse(client.execute(method));
View Full Code Here


        method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
        method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
       FilesResponse response = new FilesResponse(client.execute(method));
       
           if (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
          method.removeHeaders(FilesConstants.X_AUTH_TOKEN);
          if(login()) {
            method = new HttpGet(uri);
              method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
              method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
             response = new FilesResponse(client.execute(method));
View Full Code Here

        method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
        method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
        FilesResponse response = new FilesResponse(client.execute(method));
       
        if (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
          method.removeHeaders(FilesConstants.X_AUTH_TOKEN);
          if(login()) {
            method = new HttpGet(uri);
              method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
              method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
            response = new FilesResponse(client.execute(method));
View Full Code Here

        method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
        method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
       FilesResponse response = new FilesResponse(client.execute(method));
       
           if (response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
          method.removeHeaders(FilesConstants.X_AUTH_TOKEN);
          if(login()) {
            method = new HttpGet(uri);
              method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
              method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
             response = new FilesResponse(client.execute(method));
View Full Code Here

    TestSiteUtils.testETagHeader(getFileRequest, eTagValue, logger, null);

    httpClient = new DefaultHttpClient();
    try {
      getFileRequest.removeHeaders("If-None-Match");
      getFileRequest.setHeader("If-Modified-Since", modifiedValue);
      logger.info("Sending 'If-Modified-Since' request to {}", requestUrl);
      HttpResponse response = TestUtils.request(httpClient, getFileRequest, null);
      assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatusLine().getStatusCode());
      assertNull(response.getEntity());
View Full Code Here

      httpClient.getConnectionManager().shutdown();
    }

    httpClient = new DefaultHttpClient();
    try {
      getFileRequest.removeHeaders("If-None-Match");
      getFileRequest.setHeader("If-Modified-Since", "Wed, 10 Feb 1999 21:06:40 GMT");
      logger.info("Sending 'If-Modified-Since' request to {}", requestUrl);
      HttpResponse response = TestUtils.request(httpClient, getFileRequest, null);
      assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
      assertNotNull(response.getEntity());
View Full Code Here

    TestSiteUtils.testETagHeader(getPageRequest, eTagValue, logger, params);

    // Test If-Modified-Since header with non-modified page
    httpClient = new DefaultHttpClient();
    try {
      getPageRequest.removeHeaders("If-None-Match");
      getPageRequest.setHeader("If-Modified-Since", modifiedValue);
      logger.info("Sending 'If-Modified-Since' request to {}", requestUrl);
      HttpResponse response = TestUtils.request(httpClient, getPageRequest, params);
      assertEquals(HttpServletResponse.SC_NOT_MODIFIED, response.getStatusLine().getStatusCode());
      assertNull(response.getEntity());
View Full Code Here

    }

    // Test If-Modified-Since header with modified page
    httpClient = new DefaultHttpClient();
    try {
      getPageRequest.removeHeaders("If-None-Match");
      getPageRequest.setHeader("If-Modified-Since", "Wed, 10 Feb 1999 21:06:40 GMT");
      logger.info("Sending 'If-Modified-Since' request to {}", requestUrl);
      HttpResponse response = TestUtils.request(httpClient, getPageRequest, params);
      assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
      assertNotNull(response.getEntity());
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.