if (session == null)
{
return;
}
FileUploadListener listner = (FileUploadListener) session
.getAttribute(FileUploadRequest.FILE_UPLOAD_LISTNER);
if (listner == null || listner.getContentLength() == 0)
{
return;
}
else
{
long contentLength = listner.getContentLength();
UploadProgressDTO dto = new UploadProgressDTO();
long bytesRead = listner.getBytesRead();
dto.readBytes = bytesRead;
dto.totalBytes = contentLength;
Gson gson = new Gson();
resp.getWriter().write(gson.toJson(dto));
if (listner.isCompleted())
{
session.removeAttribute(FileUploadRequest.FILE_UPLOAD_LISTNER);
}
}