| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.core.context.PageData; |
| | | import com.java110.core.context.SecureInvocation; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.exception.FilterException; |
| | |
| | | String componentMethod = ""; |
| | | if (url.contains("callComponent")) { //组件处理 |
| | | String[] urls = url.split("/"); |
| | | |
| | | if (urls.length == 6) { |
| | | componentCode = urls[4]; |
| | | componentMethod = urls[5]; |
| | |
| | | |
| | | logger.debug("切面 获取到的pd=" + JSONObject.toJSONString(pd)); |
| | | request.setAttribute(CommonConstant.CONTEXT_PAGE_DATA, pd); |
| | | //调用链 |
| | | //Java110TraceFactory.createTrace(componentCode + "/" + componentMethod, headers); |
| | | } |
| | | |
| | | |
| | | @AfterReturning(returning = "ret", pointcut = "dataProcess()") |
| | | public void doAfterReturning(Object ret) throws Throwable { |
| | |
| | | public void after(JoinPoint jp) throws IOException { |
| | | // 接收到请求,记录请求内容 |
| | | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | |
| | | HttpServletRequest request = attributes.getRequest(); |
| | | //记录调用链 |
| | | //Java110TraceFactory.putAnnotations(TraceAnnotationsDto.VALUE_CLIENT_RECEIVE); |
| | | |
| | | PageData pd = request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA) != null ? (PageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA) : null; |
| | | //保存日志处理 |
| | | if (pd == null) { |
| | | return; |
| | | } |
| | | |
| | | //写cookies信息 |
| | | writeCookieInfo(pd, attributes); |
| | | |
| | |
| | | return o; |
| | | } catch (Throwable e) { |
| | | logger.error("执行方法异常", e); |
| | | return new ResponseEntity("内部异常" + e.getLocalizedMessage(), HttpStatus.BAD_REQUEST); |
| | | return new ResponseEntity(e.getLocalizedMessage(), HttpStatus.BAD_REQUEST); |
| | | } |
| | | } |
| | | |
| | |
| | | return token; |
| | | } |
| | | for (Cookie cookie : request.getCookies()) { |
| | | if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName()) ) { |
| | | if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName())) { |
| | | token = cookie.getValue(); |
| | | } |
| | | } |