List of usage examples for org.apache.http.client.utils URIBuilder getPath
public String getPath()
From source file:de.dentrassi.pm.jenkins.UploaderV2.java
private URI makeUrl(final String file) throws URIException, IOException { final URI fullUri; try {//from ww w .j a v a 2s . co m final URIBuilder b = new URIBuilder(this.serverUrl); b.setUserInfo("deploy", this.deployKey); b.setPath(b.getPath() + String.format("/api/v2/upload/channel/%s/%s", URIUtil.encodeWithinPath(this.channelId), file)); b.addParameter("jenkins:buildUrl", this.runData.getUrl()); b.addParameter("jenkins:buildId", this.runData.getId()); b.addParameter("jenkins:buildNumber", String.valueOf(this.runData.getNumber())); b.addParameter("jenkins:jobName", this.runData.getFullName()); final Map<String, String> properties = new HashMap<String, String>(); fillProperties(properties); for (final Map.Entry<String, String> entry : properties.entrySet()) { b.addParameter(entry.getKey(), entry.getValue()); } fullUri = b.build(); } catch (final URISyntaxException e) { throw new IOException(e); } return fullUri; }
From source file:com.thoughtworks.go.config.MingleConfig.java
public String urlFor(String path) throws URISyntaxException { URIBuilder baseUri = new URIBuilder(baseUrl); String originalPath = baseUri.getPath(); if (originalPath == null) { originalPath = ""; }/* w w w . j a v a 2 s.c o m*/ if (originalPath.endsWith(DELIMITER) && path.startsWith(DELIMITER)) { path = path.replaceFirst(DELIMITER, ""); } return baseUri.setPath(originalPath + path).toString(); }
From source file:org.blocks4j.reconf.infra.http.layer.SimpleHttpRequest.java
SimpleHttpRequest(String method, String pathBase, String... pathParam) throws URISyntaxException { this.httpMethod = method; URIBuilder baseBuilder = new URIBuilder(pathBase); if (baseBuilder.getScheme() == null) { baseBuilder = new URIBuilder("http://" + pathBase); }/*from w ww. ja v a 2s . c om*/ final StringBuilder pathBuilder = new StringBuilder(baseBuilder.getPath()); for (String param : pathParam) { pathBuilder.append("/").append(param); } this.setURI(new URI(baseBuilder.getScheme(), baseBuilder.getUserInfo(), baseBuilder.getHost(), baseBuilder.getPort(), pathBuilder.toString(), null, null)); }
From source file:org.squashtest.tm.plugin.testautomation.jenkins.internal.net.HttpRequestFactory.java
private URIBuilder concatPath(URIBuilder builder, String path) { return builder.setPath(builder.getPath() + path); }
From source file:org.jasig.portlet.proxy.service.proxy.document.URLRewritingFilter.java
protected String getRelativePathUrl(final String fullUrl) throws URISyntaxException { final URIBuilder uriBuilder = new URIBuilder(fullUrl); uriBuilder.removeQuery();//from ww w .j a v a 2 s . c o m final String path = uriBuilder.getPath(); int lastSlash = path.lastIndexOf('/'); if (lastSlash < 0) { uriBuilder.setPath(""); } else { uriBuilder.setPath(path.substring(0, lastSlash + 1)); } return uriBuilder.build().toString(); }
From source file:com.collective.celos.CelosClient.java
public void clearCache() throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + CLEAR_CACHE_PATH); executePost(uriBuilder.build());/*w w w .ja v a 2 s . c om*/ }
From source file:com.collective.celos.CelosClient.java
public void rerunSlot(WorkflowID workflowID, ScheduledTime scheduledTime) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + RERUN_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(TIME_PARAM, scheduledTime.toString()); executePost(uriBuilder.build());/*from w ww .java2 s.c om*/ }
From source file:com.collective.celos.CelosClient.java
public void setWorkflowPaused(WorkflowID workflowID, Boolean paused) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + PAUSE_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(PAUSE_NODE, paused.toString()); executePost(uriBuilder.build());/*from w ww . j a va2 s . c o m*/ }
From source file:com.collective.celos.CelosClient.java
public void kill(WorkflowID workflowID, ScheduledTime scheduledTime) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + KILL_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(TIME_PARAM, scheduledTime.toString()); executePost(uriBuilder.build());//from w ww .ja va 2s . c o m }
From source file:com.collective.celos.CelosClient.java
public void deleteRegistersWithPrefix(BucketID bucket, String prefix) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + REGISTER_PATH); uriBuilder.addParameter(BUCKET_PARAM, bucket.toString()); uriBuilder.addParameter(PREFIX_PARAM, prefix); executeDelete(uriBuilder.build());/*www. ja va 2 s .co m*/ }