AttachmentImpl att = new AttachmentImpl(id, handler);
if (!StringUtils.isEmpty(handler.getName())) {
//set Content-Disposition attachment header if filename isn't null
String file = handler.getName();
if (StringUtils.isFileExist(file)) {
file = file.substring(file.lastIndexOf(File.separator) + 1);
}
att.setHeader("Content-Disposition", "attachment;name=\"" + file + "\"");
}
att.setXOP(isXop);
return att;