com.vmware.vcloud.sdk
Class RestUtil

java.lang.Object
  extended by com.vmware.vcloud.sdk.RestUtil

public class RestUtil
extends Object

Utility class for the Rest operations (GET PUT POST DELETE). Also contains methods for upload and download


Nested Class Summary
static class RestUtil.SdkStatusCode
           
 
Method Summary
static Response delete(VcloudClient client, String url)
          This method performs a HTTP DELETE operation
static InputStream downloadFile(VcloudClient client, String downloadURL)
          Returns the inputstream of the specified downloadURL.
static Response get(VcloudClient client, String url)
          This method performs a HTTP GET operation
static Response post(VcloudClient client, String url, String content, String contentType, String charset)
          This method performs a HTTP POST operation
static Response put(VcloudClient client, String url, String content, String contentType, String charset)
          This method performs a HTTP PUT operation
static void uploadFile(VcloudClient client, com.vmware.vcloud.api.rest.schema.FileType file, InputStream is, long size, long startByte, long endByte)
          Upload the file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

delete

public static Response delete(VcloudClient client,
                              String url)
                       throws VCloudException
This method performs a HTTP DELETE operation

Parameters:
client - VcloudClient
url - String
Returns:
Response
Throws:
VCloudException

put

public static Response put(VcloudClient client,
                           String url,
                           String content,
                           String contentType,
                           String charset)
                    throws VCloudException
This method performs a HTTP PUT operation

Parameters:
client - VcloudClient
url - String
content - String
contentType - String
charset - String
Returns:
Response
Throws:
VCloudException

post

public static Response post(VcloudClient client,
                            String url,
                            String content,
                            String contentType,
                            String charset)
                     throws VCloudException
This method performs a HTTP POST operation

Parameters:
client - VcloudClient
url - String
content - String
contentType - String
charset - String
Returns:
Response
Throws:
VCloudException

get

public static Response get(VcloudClient client,
                           String url)
                    throws VCloudException
This method performs a HTTP GET operation

Parameters:
client - VcloudClient
url - String
Returns:
Response
Throws:
VCloudException

uploadFile

public static void uploadFile(VcloudClient client,
                              com.vmware.vcloud.api.rest.schema.FileType file,
                              InputStream is,
                              long size,
                              long startByte,
                              long endByte)
                       throws VCloudException
Upload the file

Parameters:
client - VcloudClient
file - FileType
is - InputStream
size - Long
startByte - Long
endByte - Long
Throws:
VCloudException

downloadFile

public static InputStream downloadFile(VcloudClient client,
                                       String downloadURL)
                                throws VCloudException
Returns the inputstream of the specified downloadURL. Close the input stream after use.

Parameters:
client - VcloudClient
downloadURL - String
Returns:
InputStream
Throws:
VCloudException


Copyright © 2016. All Rights Reserved.