public final class StreamDecoder extends Object implements Decoder
Example:
Feign.builder()
.decoder(StreamDecoder.create(JacksonIteratorDecoder.create()))
.doNotCloseAfterDecode() // Required for streaming
.target(GitHub.class, "https://api.github.com");
interface GitHub {
@RequestLine("GET /repos/{owner}/{repo}/contributors")
Stream contributors(@Param("owner") String owner, @Param("repo") String repo);
}
Decoder.Default
Modifier and Type | Method and Description |
---|---|
static StreamDecoder |
create(Decoder iteratorDecoder) |
Object |
decode(Response response,
Type type)
Decodes an http response into an object corresponding to its
generic return type . |
public Object decode(Response response, Type type) throws IOException, FeignException
Decoder
generic return type
. If you need to
wrap exceptions, please do so via DecodeException
.decode
in interface Decoder
response
- the response to decodetype
- generic return type
of the
method corresponding to this response
.type
IOException
- will be propagated safely to the caller.DecodeException
- when decoding failed due to a checked exception besides IOException.FeignException
- when decoding succeeds, but conveys the operation failed.public static StreamDecoder create(Decoder iteratorDecoder)
Copyright © 2012–2020 OpenFeign. All rights reserved.