mirror of
https://github.com/qiurunze123/miaosha.git
synced 2023-11-19 22:41:03 +08:00
clean ThreadLocal
This commit is contained in:
parent
564b7d64f3
commit
09f2d222bf
|
@ -76,6 +76,12 @@ public class AccessInterceptor extends HandlerInterceptorAdapter{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
|
super.afterCompletion(request, response, handler, ex);
|
||||||
|
UserContext.removeUser();
|
||||||
|
}
|
||||||
|
|
||||||
private void render(HttpServletResponse response, ResultStatus cm)throws Exception {
|
private void render(HttpServletResponse response, ResultStatus cm)throws Exception {
|
||||||
response.setContentType("application/json;charset=UTF-8");
|
response.setContentType("application/json;charset=UTF-8");
|
||||||
OutputStream out = response.getOutputStream();
|
OutputStream out = response.getOutputStream();
|
||||||
|
|
|
@ -14,4 +14,8 @@ public class UserContext {
|
||||||
return userHolder.get();
|
return userHolder.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void removeUser() {
|
||||||
|
userHolder.remove();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user