if (UIUtil.getBoolParameter(request, "ajaxUpload"))
{
Gson gson = new Gson();
// old browser need to see this response as html to work
response.setContentType("text/html");
JSONUploadResponse jsonResponse = new JSONUploadResponse();
String bitstreamName = null;
int bitstreamID = -1;
long size = 0;
String url = null;
if (subInfo.getBitstream() != null)
{
Bitstream bitstream = subInfo.getBitstream();
bitstreamName = bitstream.getName();
bitstreamID = bitstream.getID();
size = bitstream.getSize();
url = request.getContextPath() + "/retrieve/" + bitstreamID
+ "/" + UIUtil.encodeBitstreamName(bitstreamName);
}
jsonResponse.addUploadFileStatus(bitstreamName, bitstreamID, size,
url, status);
response.getWriter().print(gson.toJson(jsonResponse));
response.flushBuffer();
return;
}