| | |
| | | headers.put(headerName.toLowerCase(), request.getHeader(headerName)); |
| | | } |
| | | //pd = PageData.newInstance().builder(userId, userName, this.getToken(request), reqData, componentCode, componentMethod, url, sessionId, appId, headers); |
| | | headers.put("_java110_token",this.getToken(request)); |
| | | headers.put(CommonConstant.COOKIE_AUTH_TOKEN,this.getToken(request)); |
| | | pd = PageData.newInstance().builder(userId, userName, "", reqData, componentCode, componentMethod, url, sessionId, appId, headers); |
| | | pd.setMethod(request.getMethod().equals("GET") ? HttpMethod.GET : HttpMethod.POST); |
| | | |
| | |
| | | */ |
| | | private String getToken(HttpServletRequest request) throws FilterException { |
| | | String token = ""; |
| | | if (request.getCookies() != null && request.getCookies().length > 0) { |
| | | for (Cookie cookie : request.getCookies()) { |
| | | if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName())) { |
| | | token = cookie.getValue(); |
| | | } |
| | | } |
| | | } |
| | | // if (request.getCookies() != null && request.getCookies().length > 0) { |
| | | // for (Cookie cookie : request.getCookies()) { |
| | | // if (CommonConstant.COOKIE_AUTH_TOKEN.equals(cookie.getName())) { |
| | | // token = cookie.getValue(); |
| | | // } |
| | | // } |
| | | // } |
| | | String authorization = request.getHeader("Authorization"); |
| | | |
| | | if(StringUtil.isEmpty(token) && !StringUtil.isEmpty(authorization)){ |
| | | if( StringUtil.isEmpty(authorization)){ |
| | | return token; |
| | | } |
| | | if(authorization.length()> 7) { |
| | | token = authorization.substring("Bearer ".length()); |
| | | } |
| | | |
| | | return token; |
| | | } |
| | | |