Examples of removeHeaders()


Examples of org.apache.http.HttpResponse.removeHeaders()

                    if (response == null) {
                        throw new IllegalStateException("HTTP request is null");
                    }
                    // Remove connection specific headers
                    response.removeHeaders(HTTP.CONTENT_LEN);
                    response.removeHeaders(HTTP.TRANSFER_ENCODING);
                    response.removeHeaders(HTTP.SERVER_DIRECTIVE);
                    response.removeHeaders(HTTP.CONN_DIRECTIVE);
                    response.removeHeaders("Keep-Alive");
                   
                    response.setParams(this.params);
View Full Code Here

Examples of org.apache.http.HttpResponse.removeHeaders()

                        throw new IllegalStateException("HTTP request is null");
                    }
                    // Remove connection specific headers
                    response.removeHeaders(HTTP.CONTENT_LEN);
                    response.removeHeaders(HTTP.TRANSFER_ENCODING);
                    response.removeHeaders(HTTP.SERVER_DIRECTIVE);
                    response.removeHeaders(HTTP.CONN_DIRECTIVE);
                    response.removeHeaders("Keep-Alive");
                   
                    response.setParams(this.params);
                   
View Full Code Here

Examples of org.apache.http.HttpResponse.removeHeaders()

                    }
                    // Remove connection specific headers
                    response.removeHeaders(HTTP.CONTENT_LEN);
                    response.removeHeaders(HTTP.TRANSFER_ENCODING);
                    response.removeHeaders(HTTP.SERVER_DIRECTIVE);
                    response.removeHeaders(HTTP.CONN_DIRECTIVE);
                    response.removeHeaders("Keep-Alive");
                   
                    response.setParams(this.params);
                   
                    // Pre-process HTTP request
View Full Code Here

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

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

          method = new HttpHead(getStorageURL());
          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.abort();
              method = new HttpHead(getStorageURL());
              method.getParams().setIntParameter("http.socket.timeout", connectionTimeOut);
              method.setHeader(FilesConstants.X_AUTH_TOKEN, authToken);
View Full Code Here

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

     */
    @Test
    public void testDefaultContentTypeForReader() throws Exception {
        final HttpPost httpPost = new HttpPost(UriBuilder.fromUri(getBaseUri()).path("resource/plain").build());
        httpPost.setEntity(new ByteArrayEntity("value".getBytes()));
        httpPost.removeHeaders("Content-Type");

        final HttpClient httpClient = HttpClientBuilder.create().build();
        final HttpResponse response = httpClient.execute(httpPost);

        assertEquals(200, response.getStatusLine().getStatusCode());
View Full Code Here

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

    catch (HttpResponseException e)
    {
      if (e.getStatusCode() == HttpStatus.SC_EXPECTATION_FAILED)
      {
        // Retry with the Expect header removed
        put.removeHeaders(HTTP.EXPECT_DIRECTIVE);
        if (entity.isRepeatable())
        {
          return this.execute(put, handler);
        }
      }
View Full Code Here

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

        // set any request headers from the delegate
        Map<?,?> headers = delegate.getHeaders();
        for ( Object key : headers.keySet() ) {
            Object val = headers.get( key );
            if ( key == null ) continue;
            if ( val == null ) reqMethod.removeHeaders( key.toString() );
            else reqMethod.setHeader( key.toString(), val.toString() );
        }

        ResponseHandler<Object> responseHandler = new ResponseHandler<Object>() {
            public Object handleResponse(HttpResponse response)
View Full Code Here

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

        backendExpectsAnyRequestAndReturn(resp1);

        final HttpRequestWrapper req2 = HttpRequestWrapper.wrap(
                new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1));
        req2.removeHeaders("Accept-Encoding");

        final HttpResponse resp2 = HttpTestUtils.make200Response();
        resp2.setHeader("ETag","\"etag1\"");
        resp2.setHeader("Cache-Control","max-age=3600");
View Full Code Here

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

            if (needAuthentication(state)) {
                // discard previous auth headers
                final HttpRequestWrapper currentRequest = state.getCurrentRequest();
                final HttpRequest original = currentRequest.getOriginal();
                if (!original.containsHeader(AUTH.WWW_AUTH_RESP)) {
                    currentRequest.removeHeaders(AUTH.WWW_AUTH_RESP);
                }
                if (!original.containsHeader(AUTH.PROXY_AUTH_RESP)) {
                    currentRequest.removeHeaders(AUTH.PROXY_AUTH_RESP);
                }
                return true;
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.