Skip to content

Commit c183855

Browse files
committed
https://github.com/eclipse-ee4j/faces-api/issues/1570
Prepare support for SameSite; Servlet 5.1.0-M1 should be out by now but isn't in Maven yet
1 parent 26c4d96 commit c183855

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

impl/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<dependency>
5151
<groupId>jakarta.servlet</groupId>
5252
<artifactId>jakarta.servlet-api</artifactId>
53-
<version>5.0.0</version>
53+
<version>5.1.0-M1</version>
5454
<scope>provided</scope>
5555
</dependency>
5656

impl/src/main/java/com/sun/faces/context/ExternalContextImpl.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class ExternalContextImpl extends ExternalContext {
103103
private boolean distributable;
104104

105105
private enum ALLOWABLE_COOKIE_PROPERTIES {
106-
domain, maxAge, path, secure, httpOnly
106+
domain, maxAge, path, secure, httpOnly, SameSite
107107
}
108108

109109
static final Class theUnmodifiableMapClass = Collections.unmodifiableMap(new HashMap<>()).getClass();
@@ -794,6 +794,8 @@ public void addResponseCookie(String name, String value, Map<String, Object> pro
794794
case httpOnly:
795795
cookie.setHttpOnly((Boolean) v);
796796
break;
797+
case SameSite:
798+
cookie.setAttribute("SameSite", (Boolean) v);
797799
default:
798800
throw new IllegalStateException(); // shouldn't happen
799801
}

impl/src/main/java/jakarta/faces/context/ExternalContext.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public abstract class ExternalContext {
118118
*
119119
* <tr>
120120
*
121-
* <th>Key in "values" <code>Map</code></th>
121+
* <th>Key in "values" <code>Map</code> <span class="changed_added_4_0">(case sensitive)</th>
122122
*
123123
* <th>Expected type of value.</th>
124124
*
@@ -186,6 +186,16 @@ public abstract class ExternalContext {
186186
*
187187
* </tr>
188188
*
189+
* <tr class="changed_added_4_0">
190+
*
191+
* <td>SameSite</td>
192+
*
193+
* <td>Boolean</td>
194+
*
195+
* <td>setAttribute</td>
196+
*
197+
* </tr>
198+
*
189199
* </table>
190200
*
191201
* <p>

0 commit comments

Comments
 (0)