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

Commit a0d12aa

Browse files
Add docs for the converter strategy
1 parent 6a03ca0 commit a0d12aa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,19 @@ escapedCookies.get( "escaped" ); // => 北
241241
escapedCookies.get( "default" ); // => 北
242242
escapedCookies.get(); // => {escaped=北, default=北}
243243
```
244+
245+
Instead of passing a converter inline, you can also create a custom strategy by implementing the `ConverterStrategy` interface:
246+
247+
```java
248+
class CustomConverter implements ConverterStrategy {
249+
@Override
250+
public String convert( String value, String name ) throws ConverterException {
251+
return value;
252+
}
253+
}
254+
```
255+
256+
```java
257+
Cookies cookies = Cookies.initFromServlet( request, response );
258+
Cookies cookiesWithCustomConverter = cookies.withConverter( new CustomConverter() );
259+
```

0 commit comments

Comments
 (0)