writeChannel.closeFinally();
logger.info("Uploaded file name : " + fileName + " path : " + file.getFullPath() + " with size = " + rawData.length);
// step 3 : send result back to client
BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.SUCCESS, fileName, rawData.length);
resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
} catch (FileUploadException e) {
logger.log(Level.SEVERE, "failed to save file", e);
BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.FAIL, null, null);
resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
} catch (IOException e) {
logger.log(Level.SEVERE, "failed to save file", e);
BlobUploadResult result = AutoBeanUtil.newBlobUploadResult(Status.FAIL, null, null);
resultStr = AutoBeanUtil.encode(BlobUploadResult.class, result);
}
// make sure the plain json will be sent back
resp.setContentType("text/html");