T
- the mutator subtype, for method chainingpublic interface HeaderMutator<T extends HeaderMutator<T>> extends MapMutator<String,Object,T>
Header
instance.Modifier and Type | Method and Description |
---|---|
T |
contentType(String cty)
Sets the compact
cty (Content Type) header parameter value, used by applications to declare the
IANA MediaType of the JWT
payload. |
T |
setCompressionAlgorithm(String zip)
Deprecated.
since 0.12.0 and will be removed before the 1.0 release.
|
T |
setContentType(String cty)
Deprecated.
since 0.12.0 in favor of the more modern builder-style
contentType(String) . |
T |
setType(String typ)
Deprecated.
since 0.12.0 in favor of the more modern builder-style
type(String) method.
This method will be removed before the 1.0 release. |
T |
type(String typ)
Sets the JWT
typ (Type) header value. |
add, add, delete, empty
T type(String typ)
typ
(Type) header value. A null
value will remove the property from the JSON map.typ
- the JWT JOSE typ
header value or null
to remove the property from the JSON map.T contentType(String cty)
cty
(Content Type) header parameter value, used by applications to declare the
IANA MediaType of the JWT
payload. A null
value will remove the property from the JSON map.
Compact Media Type Identifier
This method will automatically remove any application/
prefix from the
cty
string if possible according to the rules defined in the last paragraph of
RFC 7517, Section 4.1.10:
To keep messages compact in common situations, it is RECOMMENDED that producers omit an "application/" prefix of a media type value in a "cty" Header Parameter when no other '/' appears in the media type value. A recipient using the media type value MUST treat it as if "application/" were prepended to any "cty" value not containing a '/'. For instance, a "cty" value of "example" SHOULD be used to represent the "application/example" media type, whereas the media type "application/example;part="1/2"" cannot be shortened to "example;part="1/2"".
JJWT performs the reverse during JWT parsing: Header.getContentType()
will automatically prepend the
application/
prefix if the parsed cty
value does not contain a '/
' character (as
mandated by the RFC language above). This ensures application developers can use and read standard IANA Media
Type identifiers without needing JWT-specific prefix conditional logic in application code.
cty
- the JWT cty
header value or null
to remove the property from the JSON map.@Deprecated T setType(String typ)
type(String)
method.
This method will be removed before the 1.0 release.type(String)
.typ
- the JWT JOSE typ
header value or null
to remove the property from the JSON map.type(String)
@Deprecated T setContentType(String cty)
contentType(String)
.contentType(String)
.cty
- the JWT JOSE cty
header value or null
to remove the property from the JSON map.contentType(String)
@Deprecated T setCompressionAlgorithm(String zip)
JwtBuilder
will
always set the zip
header as necessary.zip
- the JWT compression algorithm zip
value or null
to remove the property from the JSON map.Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.