use of org.apache.http.client.utils.URIBuilder in project sling by apache.
the class RequestUtils method appendDistributionRequest.
public static URI appendDistributionRequest(URI uri, DistributionRequest distributionRequest) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder(uri);
uriBuilder.addParameter(DistributionParameter.ACTION.toString(), distributionRequest.getRequestType().name());
String[] paths = distributionRequest.getPaths();
if (paths != null) {
for (String path : paths) {
uriBuilder.addParameter(DistributionParameter.PATH.toString(), path);
}
}
return uriBuilder.build();
}
use of org.apache.http.client.utils.URIBuilder in project sling by apache.
the class AbstractSlingClient method getUrl.
/**
* Creates a full URL for a given path with additional parameters. Same as {@link #getUrl(String)}, but adds the parameters in the URI.
*
* @param path path relative to server url; can start with / but should not include the server context path
* @param parameters url parameters to be added to the url
* @return full url as URI
* @throws IllegalArgumentException if path or parameters cannot be parsed into an URI
* @throws NullPointerException if path is null
*/
public URI getUrl(String path, List<NameValuePair> parameters) {
// add server url and path
URIBuilder uriBuilder = new URIBuilder(getUrl(path));
// add parameters
parameters = (parameters != null) ? parameters : new ArrayList<NameValuePair>(0);
uriBuilder.addParameters(parameters);
try {
return uriBuilder.build();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
use of org.apache.http.client.utils.URIBuilder in project sling by apache.
the class HttpTransportUtils method getFetchUri.
private static URI getFetchUri(URI uri) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder(uri);
uriBuilder.addParameter("operation", "fetch");
return uriBuilder.build();
}
use of org.apache.http.client.utils.URIBuilder in project sling by apache.
the class HttpTransportUtils method getDeleteUri.
private static URI getDeleteUri(URI uri, String id) throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder(uri);
uriBuilder.addParameter("operation", "delete");
uriBuilder.addParameter("id", id);
return uriBuilder.build();
}
use of org.apache.http.client.utils.URIBuilder in project ddf by codice.
the class BackupCommand method performSingleNodeSolrBackup.
private void performSingleNodeSolrBackup() throws Exception {
verifySingleNodeBackupInput();
String backupUrl = getBackupUrl(coreName);
URIBuilder uriBuilder = new URIBuilder(backupUrl);
uriBuilder.addParameter("command", "backup");
if (StringUtils.isNotBlank(backupLocation)) {
uriBuilder.addParameter("location", backupLocation);
}
if (numberToKeep > 0) {
uriBuilder.addParameter("numberToKeep", Integer.toString(numberToKeep));
}
URI backupUri = uriBuilder.build();
LOGGER.debug("Sending request to {}", backupUri.toString());
HttpWrapper httpClient = getHttpClient();
processResponse(httpClient.execute(backupUri));
}
Aggregations