Update README.md

This commit is contained in:
Les Hazlewood 2015-10-12 16:12:43 -07:00
parent 1649066038
commit e4e37373b8
1 changed files with 3 additions and 3 deletions

View File

@ -146,7 +146,7 @@ try {
If your JWT body is large and you have size restrictions (for example, if embedding a JWT in a URL and the URL must be under a certain length for legacy browsers or mail user agents), you may now compress the JWT body using a `CompressionCodec`: If your JWT body is large and you have size restrictions (for example, if embedding a JWT in a URL and the URL must be under a certain length for legacy browsers or mail user agents), you may now compress the JWT body using a `CompressionCodec`:
```java ```java
Jwts.builder().claim("foo", "someReallyDataString...") Jwts.builder().claim("foo", "someReallyLongDataString...")
.compressWith(CompressionCodecs.DEFLATE) // or CompressionCodecs.GZIP .compressWith(CompressionCodecs.DEFLATE) // or CompressionCodecs.GZIP
.signWith(SignatureAlgorithm.HS256, key) .signWith(SignatureAlgorithm.HS256, key)
.compact(); .compact();
@ -165,7 +165,7 @@ Jwts.parser().setSigningKey(key).parseClaimsJws(compact);
If the DEFLATE or GZIP algorithms are not sufficient for your needs, you can specify your own Compression algorithms by implementing the `CompressionCodec` interface and setting it on the parser: If the DEFLATE or GZIP algorithms are not sufficient for your needs, you can specify your own Compression algorithms by implementing the `CompressionCodec` interface and setting it on the parser:
```java ```java
Jwts.builder().claim("foo", "someReallyDataString...") Jwts.builder().claim("foo", "someReallyLongDataString...")
.compressWith(new MyCompressionCodec()) .compressWith(new MyCompressionCodec())
.signWith(SignatureAlgorithm.HS256, key) .signWith(SignatureAlgorithm.HS256, key)
.compact(); .compact();
@ -179,7 +179,7 @@ Jwts.parser().setSigningKey(key)
.parseClaimsJws(compact); .parseClaimsJws(compact);
``` ```
*NOTE*: Because body compression is not a standard JWT feature, you should only enable compression if both your JWT builder and parser are JJWT versions >= 0.6.0, or if you're using another library that implements the exact same functionality. It is best used for your own use cases - where you both create and later parse the tokens. This feature will likely cause problems if you compressed a token and expected a 3rd party (who doesn't use JJWT) to parse the token. *NOTE*: Because body compression is not a standard JWT feature, you should only enable compression if both your JWT builder and parser are JJWT versions >= 0.6.0, or if you're using another library that implements the exact same functionality. This feature is best reserved for your own use cases - where you both create and later parse the tokens. It will likely cause problems if you compressed a token and expected a 3rd party (who doesn't use JJWT) to parse the token.
### 0.5.1 ### 0.5.1