总结
- 权限设计(SpringSecurity)
- 根据url控制角色的访问权限
- FilterInvocationSecurityMetadataSource类
- AccessDecisionManager类
- 功能
- excel导入导出
- 浏览器上传/下载文件(Content-Type,MIME)
- https://mp.weixin.qq.com/s/C3H6eNmfBmdX7urHS5dLwA
- https://www.jianshu.com/p/9ee3204f1e24
- Servlet实现文件下载
- https://blog.csdn.net/qq_37745470/article/details/83658508
- SpringMVC文件下载(vhr项目使用)
- 在线聊天
- FastDFS搭建分布式文件管理系统,实现文件上传和下载(待定)
- Java中邮件的发送
代码
@RequestMapping(value = "/exportEmp", method = RequestMethod.GET)
public ResponseEntity<byte[]> exportEmp() {
return PoiUtils.exportEmp2Excel(empService.getAllEmployees());
}
public class PoiUtils {
public static ResponseEntity<byte[]> exportEmp2Excel(List<Employee> emps) {
HttpHeaders headers = null;
ByteArrayOutputStream baos = null;
try {
headers = new HttpHeaders();
headers.setContentDispositionFormData("attachment", new String("员工表.xls".getBytes("UTF-8"), "iso-8859-1"));
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
baos = new ByteArrayOutputStream();
workbook.write(baos);
} catch (IOException e) {
e.printStackTrace();
}
return new ResponseEntity<byte[]>(baos.toByteArray(), headers, HttpStatus.CREATED);
}
}