Package org.apache.http.client.utils

Examples of org.apache.http.client.utils.URIBuilder.build()


        URIBuilder uriBuilder = new URIBuilder();
        uriBuilder.setPath(uriPath);
        for (Map.Entry<String, String> opt : queryParams.entrySet()) {
            uriBuilder.setParameter(opt.getKey(), opt.getValue());
        }
        return uriBuilder.build();
    }
}
View Full Code Here


                    queryParams.add(new BasicNameValuePair(CouchConstants.BATCH, "ok"));
                }
                URIBuilder builder = new URIBuilder(
                        buildUri("/" + dbName + "/" + id, queryParams.toArray(new BasicNameValuePair[queryParams.size()]))
                );
                URI uri = builder.build();
                return new HttpDelete(uri);
            }

            @Override
            public String doWithResponse(HttpResponse response)
View Full Code Here

        if (params != null) {
            for (BasicNameValuePair p : params) {
                uriBuilder.addParameter(p.getName(), p.getValue());
            }
        }
        return uriBuilder.build();
    }
}
View Full Code Here

      if (params != null) {
        for (Map.Entry<String, String> entry : params.entrySet()) {
          builder.addParameter(entry.getKey(), entry.getValue());
        }
      }
      request.setURI(builder.build());

      HttpResponse response = client.execute(request);
      HttpEntity entity = response.getEntity();
      String respBody = EntityUtils.toString(entity);
      if (entity != null) {
View Full Code Here

            }
        }

        String url;
        try {
            url = urlBuilder.build().toString();
            String response = HTTPUtils.openUrl(url, method, payload.toString(), MediaType.APPLICATION_JSON,
                    null, null, null, null);
            return JSONObject.fromObject(response);
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here

            builder.setHost(serverName);
            builder.setPort(displayPort(scheme, serverPort) ? serverPort : -1);
            builder.setPath(absolutePath);
            builder.setQuery(createQueryString(params));

            URI uri = builder.build();

            if (uri != null) {
                URL url = uri.toURL();

                if (url != null) {
View Full Code Here

                            .append('=').append(value);
                }
            }

            String schemeAndHost = "";
            URI newUri = builder.build();
            if (newUri.getScheme() != null) {
                schemeAndHost = newUri.getScheme() + "://" + newUri.getHost();
            }

            updatedPath = schemeAndHost + newUri.getPath() + "?" + updatedQuery;
View Full Code Here

  public byte[] post(String uri, Map<String, String> uriParameters, byte[] content) throws URISyntaxException {
    URIBuilder builder = new URIBuilder(uri);
    for (Entry<String, String> entry : uriParameters.entrySet()) {
      builder.addParameter(entry.getKey(), entry.getValue());
    }
    return client.postData(builder.build().toString(), tokenHolder, content);
  }

  @Override
  public byte[] postForm(String uri, Map<String, String> formParameters) throws URISyntaxException {
    return postForm(uri, Collections.<String, String> emptyMap(), formParameters);
View Full Code Here

    }
    List<NameValuePair> formParams = new ArrayList<NameValuePair>();
    for (Entry<String, String> entry : formParameters.entrySet()) {
      formParams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
    }
    return client.post(builder.build().toString(), tokenHolder, formParams);
  }

  @Override
  public byte[] get(String uri) throws URISyntaxException {
    return get(uri, Collections.<String, String> emptyMap());
View Full Code Here

  public byte[] get(String uri, Map<String, String> uriParameters) throws URISyntaxException {
    URIBuilder builder = new URIBuilder(uri);
    for (Entry<String, String> entry : uriParameters.entrySet()) {
      builder.addParameter(entry.getKey(), entry.getValue());
    }
    return client.get(builder.build().toString(), tokenHolder);
  }
}
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.