/* * /combine?root=/static/styles&files=/a.css,/b.css * /combine?files=/static/styles/a.css,/static/styles/b.css */ @RequestMapping("/combine") public void handle(HttpServletRequest request, HttpServletResponse response) throws Exception { WebEnv env = (WebEnv) EapContext.getEnv(); // this.getParameter("type"); String root = this.getParameter("root"); String files = UrlUtil.decode(this.getParameter("files")); boolean debug = !env.isProMode(); // this.getParameter("minify"); if (StringUtil.isNotBlank(files)) { String resKey = request.getQueryString(); String resPath = cachedResources.get(resKey); if (resPath == null || !new File(this.getFullResPath(resPath)).exists()) { String[] fileArr = BeanUtil.removeElement(files.split(","), ""); if (fileArr.length > 0) { String fileSuffix = FileUtil.getFileNameSuffix(fileArr[0]).toLowerCase(); String[] _fileArr = new String[fileArr.length]; for (int i = 0; i < fileArr.length; i++) { _fileArr[i] = this.getWebRoot() + FileUtil.cleanPathTraversal(StringUtil.defaultIfBlank(root, "") + fileArr[i]); } if ("js".equals(fileSuffix) || "css".equals(fileSuffix)) { mkCacheDir(); resPath = CACHE_DIR + "/" + EDcodeUtil.md5(resKey) + "." + fileSuffix; Options opts = new Options(fileSuffix); opts.debug = debug; YuiCompressor.compress(opts, this.getFullResPath(resPath), _fileArr); cachedResources.put(resKey, resPath); } } } if (StringUtil.isNotBlank(resPath)) { request.getRequestDispatcher(resPath).forward(request, response); } } }
@Override public void onAuthenticationSuccess( HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException { Object principal = authentication.getPrincipal(); IUserDetailsVOWrapper userDetailsVOWrapper = (principal instanceof IUserDetailsVOWrapper) ? (IUserDetailsVOWrapper) principal : null; UserDetailsVO userDetailsVO = userDetailsVOWrapper.getUserDetailsVO(); if (userDetailsVO != null) { // if (request.getServletContext().getFilterRegistration("areaFilter") != null) { // TODO // AreaDetailsManager.setCurrAreaDetailsVO(request.getSession(), // AreaDetailsManager.getCityAreaDetailsVO(userDetailsVO.getAreaCd())); // } // userDetailsVO.setIp(HttpUtil.getRemoteAddr(request)); // userDetailsVO.setAdvertisingMedia(GlobalVars.getAdvertisingMedia(request)); // if (casAvailable) { // if (authentication instanceof CasAuthenticationToken) { // CasAuthenticationToken cat = (CasAuthenticationToken) authentication; //// userDetailsVO.setLoginAcctNo(cat.getAssertion().getPrincipal().getName()); // } else if (authentication instanceof CasAssertionAuthenticationToken) { // CasAssertionAuthenticationToken casat = (CasAssertionAuthenticationToken) // authentication; //// userDetailsVO.setLoginAcctNo(casat.getAssertion().getPrincipal().getName()); // } // } } if ("ssoFrame".equalsIgnoreCase(request.getParameter("type"))) { // /loginCheck RequestCache requestCache = ReflectUtil.getFieldValue(this, "requestCache", RequestCache.class); SavedRequest savedRequest = requestCache.getRequest(request, response); if (savedRequest == null) { if (!response.isCommitted()) { String targetUrl = determineTargetUrl(request, response); DefaultRedirectStrategy redirectStrategy = (DefaultRedirectStrategy) this.getRedirectStrategy(); String redirectUrl = (String) ReflectUtil.invokeMethod( redirectStrategy, "calculateRedirectUrl", new Object[] {request.getContextPath(), targetUrl}); redirectUrl = response.encodeRedirectURL(redirectUrl); HttpSession session = request.getSession(true); String ssoAuto = (String) session.getAttribute("_SECURITY_SSO_AUTO"); // 自动登录 if (Boolean.parseBoolean(ssoAuto)) { session.removeAttribute("_SECURITY_SSO_AUTO"); String callbackUrl = (String) session.getAttribute("_SECURITY_SSO_CALLBACK_URL"); session.removeAttribute("_SECURITY_SSO_CALLBACK_URL"); redirectStrategy.sendRedirect( request, response, StringUtil.defaultIfBlank(callbackUrl, redirectUrl)); } else { redirectStrategy.sendRedirect( request, response, ssoFrameTargetUrl + "?targetUrl=" + redirectUrl); } } clearAuthenticationAttributes(request); } else { requestCache.removeRequest(request, response); clearAuthenticationAttributes(request); this.getRedirectStrategy() .sendRedirect( request, response, ssoFrameTargetUrl + "?targetUrl=" + savedRequest.getRedirectUrl()); } } else if (isAjaxRequest(request)) { this.onAuthenticationSuccessForAjax(request, response, authentication); } else { super.onAuthenticationSuccess(request, response, authentication); } EapContext.publish("#login.success", authentication); }