Examples of addInterceptorFirst()


Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

        {
          assertNotNull(r.getHeaders(HttpHeaders.CONTENT_RANGE));
          assertEquals(1, r.getHeaders(HttpHeaders.CONTENT_RANGE).length);
        }
      });
      client.addInterceptorFirst(new HttpResponseInterceptor()
      {
        public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
        {
          assertEquals(204, r.getStatusLine().getStatusCode());
        }
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

  @Test
  public void testGetRange() throws Exception
  {
    final HttpClientBuilder client = HttpClientBuilder.create();
    client.addInterceptorFirst(new HttpResponseInterceptor()
    {
      public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
      {
        // Verify partial content response
        assertEquals(206, r.getStatusLine().getStatusCode());
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

  @Test
  public void testBasicPreemptiveAuthHeader() throws Exception
  {
    final HttpClientBuilder client = HttpClientBuilder.create();
    client.addInterceptorFirst(new HttpRequestInterceptor()
    {
      public void process(final HttpRequest r, final HttpContext context) throws HttpException, IOException
      {
        assertNotNull(r.getHeaders(HttpHeaders.AUTHORIZATION));
        assertEquals(1, r.getHeaders(HttpHeaders.AUTHORIZATION).length);
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

  @Test
  public void testGetSingleFileGzip() throws Exception
  {
    final HttpClientBuilder client = HttpClientBuilder.create();
    client.addInterceptorFirst(new HttpResponseInterceptor()
    {
      public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
      {
        assertEquals(200, r.getStatusLine().getStatusCode());
        assertNotNull(r.getHeaders(HttpHeaders.CONTENT_ENCODING));
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

  @Test
  public void testPutRange() throws Exception
  {
    final HttpClientBuilder client = HttpClientBuilder.create();
    client.addInterceptorFirst(new HttpResponseInterceptor()
    {
      public void process(final HttpResponse r, final HttpContext context) throws HttpException, IOException
      {
        assertEquals(201, r.getStatusLine().getStatusCode());
      }
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

    {
      // Append to existing file
      final Map<String, String> header = Collections.singletonMap(HttpHeaders.CONTENT_RANGE,
          "bytes " + 2 + "-" + 3 + "/" + 4);

      client.addInterceptorFirst(new HttpRequestInterceptor()
      {
        public void process(final HttpRequest r, final HttpContext context) throws HttpException, IOException
        {
          assertNotNull(r.getHeaders(HttpHeaders.CONTENT_RANGE));
          assertEquals(1, r.getHeaders(HttpHeaders.CONTENT_RANGE).length);
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

            credentialsProvider.setCredentials(
                    new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
                    new UsernamePasswordCredentials(graphiteUsername, graphitePassword));
            clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
            context.setAttribute("preemptive-auth", new BasicScheme());
            clientBuilder.addInterceptorFirst(new PreemptiveAuth());
        }
       
        return clientBuilder.build();
    }
   
View Full Code Here

Examples of org.apache.http.impl.client.HttpClientBuilder.addInterceptorFirst()

  }

  public static CloseableHttpClient newClient(int timeout) {
    HttpClientBuilder builder = HttpClients.custom();
    builder.useSystemProperties();
    builder.addInterceptorFirst(REMOVE_INCORRECT_CONTENT_ENCODING);
    builder.disableAutomaticRetries();

    builder.setSslcontext(SSL_CONTEXT);
    builder.setHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
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.