The logic in GsonCodec was split into GsonEncoder and GsonDecoder, each of which can
now be used separately. GsonCodec was deprecated, and can be removed in the next major
version. To facilitate use outside of Dagger, the double-to-int map type adapter was broken into
its own class, and is included by default when using the default constructors of either the
encoder or decoder. The examples have been updated to use the new encoder/decoder instead
of the codec.
Previously, the default decoder had logic relating to responses that made it distinct from StringDecoder.
Now that that's handled elsewhere, the body of the decode methods had less meaningful differences.
I opted to maintain Decoder.Default for consistency with other default implementations. StringDecoder
is maintained as a separate class for backwards compatibility, and because it may be useful in the
future for clients to use a plain String decoder even if the default decoder starts having additional
capabilities.
For those who do not use Dagger, or do not wish to, this provides an alternate method of defining dependencies.
This includes logging config, decoders, etc. It still uses Dagger under the scenes, but doesn't require the user
to deal with the module system.
Decoder.Default's decoding to Response didn't actually work; the reader would always
be closed when used from Feign, as it depended on the url connection, which would
have been closed by the time the Response object was returned to the client.
This wasn't noticed because the default decoder tests don't use the mock web server.
There will be test coverage added for this shortly as part of the enhancements to
support a Builder.
This is intended as a step towards simplifying Feign.
This changeset removes the generics from both interfaces, and changes their
Dagger bindings from SET to UNIQUE.
Additionally, in changing the signatures for Encoder/Decoder, it focuses on use
of the RequestTemplate and Response objects, allowing us to extend them
in the future to support binary data without needing to change the
Encoder/Decoder signatures again.
They look something like this:
java.lang.NullPointerException
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:88)
at feign.$Proxy16.equals(Unknown Source)
In my particular instance, I had a proxy created by Feign registered in a Spring application context,
and it resulted in a NullPointerException on application shutdown.
Enhances the default client to GZIP-encode request bodies when the appropriate
content-encoding header is set in the interface's method definition.
https://github.com/Netflix/feign/issues/52