You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
1.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## 文件上传
### 前端部分
三要素
```html
<from method ="post" enctype="multipart.from-data">
<input type = "file"><br>
</from>
```
### 后端部分
#### 文件接收
提交的文件在controller中使用springboot提供的api接收
`MultipartFile yourFileName`
#### 文件保存
## 登录认证功能
### 会话技术
由于同一会话之间需要数据共享http协议无状态。所以需要会话跟踪技术
- 客户端会话跟踪技术: Cookie
优点http支持浏览器自动
缺点移动端App无法使用不安全用户可以自己禁用。不能跨域协议、IP、域名和端口
- 服务端会话跟踪技术: Session
优点基于Cookie但存在与服务器安全
缺点只能用在单机位服务器。无法使用负载均衡的集群环境下使用。Cookie的缺点
- 令牌技术
优点:支持所有端,解决集群下的认证问题,减轻服务器存储压力
缺点:需要自己实现
### JWT令牌
JSON WEB TOKEN
组成
头,记录令牌类型,签名算法
有效载荷,携带自定义信息
签名,数字签名
eg:登录认证
使用流程:
1. 引入依赖
## 异常处理
- 在contraller层处理异常
- 定义全局异常处理器(推荐)