From 41333a7712d4c9bb54346c720ef1de0da09abfca Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 18 Sep 2024 21:57:30 +1000 Subject: [PATCH] Issue #12255 Dump CookieConfig (#12257) --- .../eclipse/jetty/ee10/servlet/SessionHandler.java | 12 ++++++++++++ .../org/eclipse/jetty/ee9/nested/SessionHandler.java | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/SessionHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/SessionHandler.java index c3196f2c788d..2331e48e9c9f 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/SessionHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/SessionHandler.java @@ -251,6 +251,14 @@ public void setSecure(boolean secure) SessionHandler.this.setSecureCookies(secure); } + @Override + public String toString() + { + return String.format("%s@%x[name=%s,domain=%s,path=%s,max-age=%d,secure=%b,http-only=%b,comment=%s,attributes=%s]", + this.getClass().getName(), this.hashCode(), getName(), getDomain(), getPath(), + getMaxAge(), isSecure(), isHttpOnly(), getComment(), getSessionCookieAttributes().toString()); + } + private void checkState() { //It is allowable to call the CookieConfig.setXX methods after the SessionHandler has started, @@ -381,6 +389,10 @@ public boolean isNew() public SessionHandler() { setSessionTrackingModes(DEFAULT_SESSION_TRACKING_MODES); + installBean(_cookieConfig); + installBean(_sessionListeners); + installBean(_sessionIdListeners); + installBean(_sessionAttributeListeners); } @Override diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/SessionHandler.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/SessionHandler.java index 214e2b871ce6..9c2848512ea2 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/SessionHandler.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/SessionHandler.java @@ -729,6 +729,14 @@ public void setSecure(boolean secure) checkAvailable(); _sessionManager.setSecureCookies(secure); } + + @Override + public String toString() + { + return String.format("%s@%x[name=%s,domain=%s,path=%s,max-age=%d,secure=%b,http-only=%b,same-site=%s,comment=%s]", + this.getClass().getName(), this.hashCode(), _sessionManager.getSessionCookie(), _sessionManager.getSessionDomain(), _sessionManager.getSessionPath(), + _sessionManager.getMaxCookieAge(), _sessionManager.isSecureCookies(), _sessionManager.isHttpOnly(), _sessionManager.getSameSite(), _sessionManager.getSessionComment()); + } } private class CoreSessionManager extends AbstractSessionManager