Package org.apache.http.client.methods

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


    }
   
    private void invokeRsService(String getUrl, String expected) throws Exception {
        HttpGet get = new HttpGet(getUrl);
        get.addHeader("Accept" , "application/json");
        get.addHeader("key", "customer");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
View Full Code Here


        }
    }

    private String getCustomerId(String name) throws Exception {
        HttpGet get = new HttpGet("http://localhost:" + PORT1 + "/customerservice/customers/");
        get.addHeader("Accept", "application/xml");
        HttpClient httpclient = new DefaultHttpClient();

        try {
            HttpResponse response = httpclient.execute(get);
            assertEquals(200, response.getStatusLine().getStatusCode());
View Full Code Here

        {
            SimpleDateFormat fmt = new SimpleDateFormat( "EEE, dd-MMM-yy HH:mm:ss zzz", Locale.US );
            fmt.setTimeZone( GMT_TIME_ZONE );
            Header hdr = new BasicHeader( "If-Modified-Since", fmt.format( new Date( timestamp ) ) );
            fireTransferDebug( "sending ==> " + hdr + "(" + timestamp + ")" );
            getMethod.addHeader( hdr );
        }

        try
        {
            CloseableHttpResponse response = execute( getMethod );
View Full Code Here

          LOG.error("host is null, url: " + uri.toString());
          httphost  = new HttpHost(uri.getHost());
        }
        Map<String, String> headerMap = request.getHeaderMap();
        for(String key: headerMap.keySet()){
          httpget.addHeader(key, headerMap.get(key));
        }
        if(request.getReadTimeout() > 0){
          HttpConnectionParams.setSoTimeout(httpget.getParams(), request.getReadTimeout());
        }
        if(request.getConnectTimeout() > 0){
View Full Code Here


   @Override
   public void process(KeyFilter keyFilter, final CacheLoaderTask cacheLoaderTask, Executor executor, boolean loadValue, boolean loadMetadata) {
      HttpGet get = new HttpGet(path + "?global");
      get.addHeader(HttpHeaders.ACCEPT, "text/plain");
      get.addHeader(HttpHeaders.ACCEPT_CHARSET, "UTF-8");
      try {
         HttpResponse response = httpClient.execute(httpHost, get);
         HttpEntity entity = response.getEntity();
         int batchSize = 1000;
View Full Code Here

   @Override
   public void process(KeyFilter keyFilter, final CacheLoaderTask cacheLoaderTask, Executor executor, boolean loadValue, boolean loadMetadata) {
      HttpGet get = new HttpGet(path + "?global");
      get.addHeader(HttpHeaders.ACCEPT, "text/plain");
      get.addHeader(HttpHeaders.ACCEPT_CHARSET, "UTF-8");
      try {
         HttpResponse response = httpClient.execute(httpHost, get);
         HttpEntity entity = response.getEntity();
         int batchSize = 1000;
         ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor);
View Full Code Here

   }

   @Override
   public int size() {
      HttpGet get = new HttpGet(path + "?global");
      get.addHeader(HttpHeaders.ACCEPT, "text/plain");

      try {
         HttpResponse response = httpClient.execute(httpHost, get);
         HttpEntity entity = response.getEntity();
         BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
View Full Code Here

      for (NameValuePair param : params) {
        builder.addParameter(param.getName(), param.getValue());
      }
    }
    HttpGet method = new HttpGet(builder.build());
    method.addHeader("Accept", "application/json");
    try {

      // Preemptive authentication enabled - see
      // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d5e1032
      HttpHost targetHost = new HttpHost(builder.getHost(), builder.getPort(), builder.getScheme());
View Full Code Here

  private void getRest(String rightside, JiraJSONResponse response)
    throws IOException, ResponseException {

    final HttpRequestBase method = new HttpGet(URLbase + rightside);
    method.addHeader("Accept", "application/json");

    try {
      HttpResponse httpResponse = httpClient.execute(method);
      int resultCode = httpResponse.getStatusLine().getStatusCode();
      if (resultCode != 200)
View Full Code Here

  private void getRest(String rightside, JiraJSONResponse response)
    throws IOException, ResponseException {

    final HttpRequestBase method = new HttpGet(URLbase + rightside);
    method.addHeader("Accept", "application/json");

    try {
      HttpResponse httpResponse = httpClient.execute(method);
      int resultCode = httpResponse.getStatusLine().getStatusCode();
      if (resultCode != 200)
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.