Explorar o código

文件上传;流被读取问题。

huangzhiyong %!s(int64=8) %!d(string=hai) anos
pai
achega
7913770835
Modificáronse 1 ficheiros con 19 adicións e 14 borrados
  1. 19 14
      src/main/java/com/yihu/hos/filter/SessionOutTimeFilter.java

+ 19 - 14
src/main/java/com/yihu/hos/filter/SessionOutTimeFilter.java

@ -42,24 +42,29 @@ public class SessionOutTimeFilter extends OncePerRequestFilter {
            return;
        }
        String token  = httpServletRequest.getParameter(ContextAttributes.ACCESSTOKEN);
        String clientId  = httpServletRequest.getParameter(ContextAttributes.CLIENTID);
        String token = null;
        String clientId = null;
        String contentType = httpServletRequest.getHeader("content-type");
        if (contentType != null && !contentType.contains("multipart/form-data")) {
            token = httpServletRequest.getParameter("token");
            clientId = httpServletRequest.getParameter("clientId");
        }
        if (token == null || clientId == null){
        if (httpServletRequest.getSession(false) == null
                || httpServletRequest.getSession().getAttribute("userInfo")==null) {
        if (token == null || clientId == null) {
            if (httpServletRequest.getSession(false) == null
                    || httpServletRequest.getSession().getAttribute("userInfo") == null) {
            // AJAX REQUEST PROCESS
            String attachment = LocalContext.getContext().getAttachment(ContextAttributes.TENANT_NAME);
            if ("XMLHttpRequest".equalsIgnoreCase(httpServletRequest.getHeader("X-Requested-With"))) {
                httpServletResponse.setHeader("sessionStatus", "timeOut");
                httpServletResponse.getWriter().print("{}");
                httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/logoutAction");
                // AJAX REQUEST PROCESS
                String attachment = LocalContext.getContext().getAttachment(ContextAttributes.TENANT_NAME);
                if ("XMLHttpRequest".equalsIgnoreCase(httpServletRequest.getHeader("X-Requested-With"))) {
                    httpServletResponse.setHeader("sessionStatus", "timeOut");
                    httpServletResponse.getWriter().print("{}");
                    httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/logoutAction");
                    return;
                }
                httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/" + attachment + "/loginPage");
                return;
            }
            httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/" +attachment+  "/loginPage");
            return;
        }
        }
        filterChain.doFilter(httpServletRequest, httpServletResponse);