From c0c25f29ca9a83e8d784f1290516e46ca18280bf Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Wed, 29 Sep 2021 13:52:19 +0800 Subject: [PATCH] token --- .../anjiplus/template/gaea/business/filter/TokenFilter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java index a5b293f5..52e601e7 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java @@ -8,6 +8,7 @@ import com.anji.plus.gaea.utils.JwtBean; import com.anjiplus.template.gaea.business.constant.BusinessConstant; import com.anjiplus.template.gaea.business.util.JwtUtil; import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.annotation.Order; @@ -129,9 +130,11 @@ public class TokenFilter implements Filter { if (HttpMethod.POST.name().equalsIgnoreCase(method) || HttpMethod.PUT.name().equalsIgnoreCase(method) || HttpMethod.DELETE.name().equalsIgnoreCase(method) + || uri.contains("/reportDashboard/export") ) { ResponseBean responseBean = ResponseBean.builder().code("50001") .message("在线体验版本,不允许此操作。请自行下载本地运行").build(); + response.setContentType(ContentType.APPLICATION_JSON.getMimeType()); response.getWriter().print(JSONObject.toJSONString(responseBean)); return; } @@ -173,6 +176,7 @@ public class TokenFilter implements Filter { private void error(HttpServletResponse response) throws IOException { ResponseBean responseBean = ResponseBean.builder().code("50014").message("The Token has expired").build(); + response.setContentType(ContentType.APPLICATION_JSON.getMimeType()); response.getWriter().print(JSONObject.toJSONString(responseBean)); } }