I'm using the following code to upload a file to a server. Is there a way to 
tell how much time was spent uploading the bytes, and then how much time was 
spent waiting for the response?

HttpMethodParams methodParams = new HttpMethodParams();
methodParams.setSoTimeout(360*1000);

String queryParams = "cvn=17";
queryParams += "&ticket=" + ticket.getServerTicket();


Part[] parts = {
new StringPart("Filename", file.getName()),
new StringPart("WorkspaceID", workspaceId),
new StringPart("wf.documentName", name),
new StringPart("serviceName", "digital_publishing"),
new StringPart("workflow", "AddDocument"),
new StringPart("Upload", "Submit Query"),
new StringPart("assetID", assetId),
new StringPart("objectId", id),
new FilePart("Filedata", file)
};


PostMethod postMethod = new PostMethod(assetUploadUrl);
postMethod.setQueryString(URIUtil.encodeQuery(queryParams));
postMethod.setParams(methodParams);
postMethod.setRequestEntity(new MultipartRequestEntity(parts, 
postMethod.getParams()));

int responseCode = httpClient.executeMethod(postMethod);
if (responseCode == HttpServletResponse.SC_OK)
{
Element responseBody = 
XmlUtils.parseXmlDocument(postMethod.getResponseBodyAsStream()).getRootElement();
}

Thanks,
Michael-

Reply via email to