Example usage for org.apache.http.client.methods HttpPut toString

List of usage examples for org.apache.http.client.methods HttpPut toString

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpPut toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.sonatype.nexus.perftest.maven.ArtifactDeployer.java

private void deploy0(HttpEntity entity, String groupId, String artifactId, String version, String extension)
        throws IOException {
    StringBuilder path = new StringBuilder();

    path.append(groupId.replace('.', '/')).append('/');
    path.append(artifactId).append('/');
    path.append(version).append('/');
    path.append(artifactId).append('-').append(version).append(extension);

    HttpPut httpPut = new HttpPut(repoUrl + path);
    httpPut.setEntity(entity);// ww  w.  j a  v  a  2  s .  com

    HttpResponse response;
    try {
        response = httpclient.execute(httpPut);

        try {
            EntityUtils.consume(response.getEntity());
        } finally {
            httpPut.releaseConnection();
        }
    } catch (IOException e) {
        throw new IOException("IOException executing " + httpPut.toString(), e);
    }

    if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) {
        throw new IOException(httpPut.toString() + " : " + response.getStatusLine().toString());
    }
}

From source file:org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.java

private HttpPut createHttpPutMethod(DeployDetails details, String uploadUrl)
        throws UnsupportedEncodingException {
    StringBuilder deploymentPathBuilder = new StringBuilder().append(uploadUrl);
    deploymentPathBuilder.append(DeploymentUrlUtils.buildMatrixParamsString(details.getProperties()));
    HttpPut httpPut = new HttpPut(deploymentPathBuilder.toString());
    httpPut.addHeader("X-Checksum-Sha1", details.getSha1());
    httpPut.addHeader("X-Checksum-Md5", details.getMd5());
    log.debug("Full Artifact Http path: " + httpPut.toString() + "\n@Http Headers: "
            + Arrays.toString(httpPut.getAllHeaders()));

    return httpPut;
}

From source file:org.jenkinsci.plugins.skytap.SkytapUtils.java

/**
 * This method returns an http put request object, given a url and the
 * encoded Skytap authorization token.//w  ww.j a va2  s. c  o  m
 * 
 * @param requestUrl
 * @param AuthToken
 * @return
 */
public static HttpPut buildHttpPutRequest(String requestUrl, String AuthToken) {

    HttpPut httpput = new HttpPut(requestUrl);
    String authHeaderValue = "Basic " + AuthToken;

    httpput.addHeader("Authorization", authHeaderValue);
    httpput.addHeader("Accept", "application/json");
    httpput.addHeader("Content-Type", "application/json");

    JenkinsLogger.log("HTTP PUT Request: " + httpput.toString());

    return httpput;
}