{
// execute the POST
String complURL = protocol + "://" + host + sURL;
URL url = new URL(complURL);
HTTPConnection connection = new HTTPConnection(url);
connection.removeModule(CookieModule.class);
connection.addBasicAuthorization(getRealm(complURL), login, password);
HTTPResponse resp;
if (postData == null)
{
resp = connection.Post(url.getFile());
}
else
{
NVPair[] pairs = new NVPair[2];
pairs[0] = new NVPair("Content-Type", "application/json; charset=UTF-8");
pairs[1] = new NVPair("Content-Length", Integer.toString(postData.length()));
resp = connection.Post(url.getFile(), postData.getBytes(), pairs);
}
BackupAgentResponse responce = new BackupAgentResponse(resp.getData(), resp.getStatusCode());
return responce;
}