Class EncoderSet
encoders
keyed by codings.
Description
Maintains a set of encoders and the codings that they can handle.
The getEncoderMatch(String)
and getEncoder(String)
methods are then used to find appropriate
encoders for specific
Match ordering
Encoders are matched against
Encoders are tried in the order they appear in the set. The EncoderSet.Builder.add(Class...)
/EncoderSet.Builder.add(Encoder...)
methods prepend the values to the list to allow them the opportunity to override encoders already in the list.
For example, calling groupBuilder.add(E1.
will result in the order
Example:
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class.static class
An identifier that the previous encoders in this group should be inherited.static class
An identifier that the previous encoders in this group should not be inherited. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic EncoderSet.Builder
create()
Static creator.static EncoderSet.Builder
Static creator.getEncoder
(String encoding) Returns the encoder registered with the specified coding (e.g.getEncoderMatch
(String acceptEncoding) Returns the coding string for the matching encoder that can handle the specifiedAccept-Encoding orContent-Encoding header value.Returns the set of codings supported by all encoders in this group.
-
Constructor Details
-
EncoderSet
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
Static creator.- Parameters:
beanStore
- The bean store to use for creating beans.- Returns:
- A new builder for this object.
-
create
Static creator.- Returns:
- A new builder for this object.
-
getEncoderMatch
Returns the coding string for the matching encoder that can handle the specifiedAccept-Encoding orContent-Encoding header value.Returns
null if no encoders can handle it.This method is fully compliant with the RFC2616/14.3 and 14.11 specifications.
- Parameters:
acceptEncoding
- TheAccept-Encoding orContent-Encoding value.- Returns:
- The coding value (e.g.
"gzip" ).
-
getEncoder
Returns the encoder registered with the specified coding (e.g."gzip" ).- Parameters:
encoding
- The coding string.- Returns:
- The encoder, or
null if encoder isn't registered with that coding.
-
getSupportedEncodings
Returns the set of codings supported by all encoders in this group.- Returns:
- An unmodifiable list of codings supported by all encoders in this group. Never
null .
-