Skip to content

Commit be30770

Browse files
committed
improved druid monitor, add StatViewFilter
1 parent 4cfb523 commit be30770

File tree

4 files changed

+350
-166
lines changed

4 files changed

+350
-166
lines changed

src/main/java/com/alibaba/druid/support/http/AbstractWebStatImpl.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public WebSessionStat getSessionStat(HttpServletRequest request) {
9090

9191
WebSessionStat sessionStat = null;
9292
String sessionId = getSessionId(request);
93+
9394
if (sessionId != null) {
9495
sessionStat = webAppStat.getSessionStat(sessionId, true);
9596
}
@@ -139,6 +140,25 @@ public String getSessionId(HttpServletRequest httpRequest) {
139140
HttpSession session = httpRequest.getSession(createSession);
140141
if (session != null) {
141142
sessionId = session.getId();
143+
} else {
144+
Cookie[] cookies = httpRequest.getCookies();
145+
if (cookies != null) {
146+
for (Cookie cookie : cookies) {
147+
if (cookie.getName().equals("JSESSIONID")) {
148+
sessionId = cookie.getValue();
149+
break;
150+
}
151+
}
152+
153+
if (sessionId == null) {
154+
for (Cookie cookie : cookies) {
155+
if (cookie.getName().equals("JWT-SESSION")) {
156+
sessionId = cookie.getValue();
157+
break;
158+
}
159+
}
160+
}
161+
}
142162
}
143163

144164
return sessionId;

0 commit comments

Comments
 (0)