fix: ApiKeyFilter日志部分增加异常处理

ApiKeyFilter日志部分增加异常处理
This commit is contained in:
song.tianyang 2021-03-05 18:11:06 +08:00
parent 2c522657e5
commit 5d6f846420
1 changed files with 9 additions and 3 deletions

View File

@ -16,9 +16,15 @@ public class ApiKeyFilter extends AnonymousFilter {
@Override @Override
protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) { protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) {
try { try {
try{
//这部分代码是为了测试打包完成之后能否访问文档相关路径封版之前要删除
HttpServletRequest httpServlet = WebUtils.toHttp(request); HttpServletRequest httpServlet = WebUtils.toHttp(request);
String url = httpServlet.getRequestURL().toString(); String url = httpServlet.getRequestURL().toString();
LogUtil.info("Url message : "+url); LogUtil.info("Url message : "+url);
}catch (Exception e){
}
if (!SecurityUtils.getSubject().isAuthenticated()) { if (!SecurityUtils.getSubject().isAuthenticated()) {
String userId = ApiKeyHandler.getUser(WebUtils.toHttp(request)); String userId = ApiKeyHandler.getUser(WebUtils.toHttp(request));
if (StringUtils.isNotBlank(userId)) { if (StringUtils.isNotBlank(userId)) {