Package org.apache.http.client.fluent

Examples of org.apache.http.client.fluent.Request.addHeader()


      final Request request = Request.Post("http://" + host + ":" + port)
          .socketTimeout(0).connectTimeout(0);
      if (proxyhost != null && proxyport != null) {
        request.viaProxy(new HttpHost(proxyhost, Integer.valueOf(proxyport)));
      }
      final HttpResponse response = request
          .addHeader(Version.HEADER, Version.getCurrentVersion().toString())
          .bodyByteArray(bytes).execute().returnResponse();
      return handleResponse(response);
    } catch (final Exception e) {
      if (e instanceof SmallerException) {
View Full Code Here


    }

    public String getWithHeader(String url, ImmutableMap<String, String> headers) throws IOException {
        Request request = Request.Get(url);
        for (Map.Entry<String, String> entry : headers.entrySet()) {
            request = request.addHeader(entry.getKey(), entry.getValue());
        }

        return get(request);
    }
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.