This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new fb15f818bc FELIX-6678 : Setter methods in SessionCookieConfig do not 
throw IllegalStateException
fb15f818bc is described below

commit fb15f818bc8aab2d3d0207385aed768c242d778a
Author: Carsten Ziegeler <cziege...@apache.org>
AuthorDate: Wed Jan 3 10:42:46 2024 +0100

    FELIX-6678 : Setter methods in SessionCookieConfig do not throw 
IllegalStateException
---
 .../whiteboard/SharedServletContextImpl.java       | 96 +++++++++++++++++++++-
 http/jetty/pom.xml                                 |  2 +-
 http/jetty12/pom.xml                               |  2 +-
 3 files changed, 97 insertions(+), 3 deletions(-)

diff --git 
a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java
 
b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java
index 12b3c0410d..5a96c14700 100644
--- 
a/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java
+++ 
b/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/SharedServletContextImpl.java
@@ -417,7 +417,7 @@ public class SharedServletContextImpl implements 
ServletContext
     @Override
     public SessionCookieConfig getSessionCookieConfig()
     {
-        return this.context.getSessionCookieConfig();
+        return new 
ImmutableSessionCookieConfig(this.context.getSessionCookieConfig());
     }
 
     public void log(final Exception cause, final String message)
@@ -516,4 +516,98 @@ public class SharedServletContextImpl implements 
ServletContext
     public void setResponseCharacterEncoding(final String encoding) {
         throw new IllegalStateException();
     }
+
+    private static class ImmutableSessionCookieConfig implements 
SessionCookieConfig {
+
+        private final SessionCookieConfig delegate;
+
+        public ImmutableSessionCookieConfig(final SessionCookieConfig 
delegate) {
+            this.delegate = delegate;
+        }
+
+        @Override
+        public String getComment() {
+            return delegate.getComment();
+        }
+
+        @Override
+        public String getDomain() {
+            return delegate.getDomain();
+        }
+
+        @Override
+        public int getMaxAge() {
+            return delegate.getMaxAge();
+        }
+
+        @Override
+        public String getName() {
+            return delegate.getName();
+        }
+
+        @Override
+        public String getPath() {
+            return delegate.getPath();
+        }
+
+        @Override
+        public boolean isHttpOnly() {
+            return delegate.isHttpOnly();
+        }
+
+        @Override
+        public boolean isSecure() {
+            return delegate.isSecure();
+        }
+
+        @Override
+        public void setComment(final String comment) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setDomain(final String domain) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setHttpOnly(final boolean httpOnly) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setMaxAge(final int maxAge) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setName(final String name) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setPath(final String path) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public void setSecure(final boolean secure) {
+            throw new IllegalStateException();
+        }
+
+        @Override
+        public String getAttribute(String name) {
+            return delegate.getAttribute(name);
+        }
+
+        @Override
+        public Map<String, String> getAttributes() {
+            return delegate.getAttributes();
+        }
+
+        @Override
+        public void setAttribute(String name, String value) {
+            throw new IllegalStateException();
+        }
+    }
 }
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 37065531bc..b95c3d70a0 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -431,7 +431,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>5.1.4</version>
+            <version>5.1.5-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
diff --git a/http/jetty12/pom.xml b/http/jetty12/pom.xml
index cf58d1f80b..414aa0bc15 100644
--- a/http/jetty12/pom.xml
+++ b/http/jetty12/pom.xml
@@ -435,7 +435,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>5.1.4</version>
+            <version>5.1.5-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>

Reply via email to