Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 4e66c8a

Browse files
Add path docs
1 parent a1f52ff commit 4e66c8a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,26 @@ Define when the cookie will be removed. Value can be an `Expiration.days()` whic
139139

140140
```java
141141
DateTime date_2015_06_07_23h38m46s = new DateTime( 2015, 6, 7, 23, 38, 46 );
142+
Cookies cookies = Cookies.initFromServlet( request, response );
142143
cookies.set( "name", "value", Attributes.empty()
143144
.expires( Expiration.date( date_2015_06_07_23h38m46s ) )
144145
);
145146
cookies.get( "name" ); // => "value"
146147
cookies.remove( "name" );
147148
```
149+
150+
### path
151+
152+
Define the path where the cookie is available.
153+
154+
**Default:** `/`
155+
156+
**Examples:**
157+
158+
```java
159+
Cookies cookies = Cookies.initFromServlet( request, response );
160+
Attributes validToTheCurrentPage = Attributes.empty().path( "" );
161+
cookies.set( "name", "value", validToTheCurrentPath );
162+
cookies.get( "name" ); // => "value"
163+
cookies.remove( "name", validToTheCurrentPath );
164+
```

0 commit comments

Comments
 (0)