org.zalando.riptide.compatibility.ExtractRoute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-compatibility Show documentation
Show all versions of riptide-compatibility Show documentation
Client side response routing
The newest version!
package org.zalando.riptide.compatibility;
import org.springframework.web.client.ResponseExtractor;
import org.zalando.riptide.Route;
import org.zalando.riptide.capture.Capture;
import javax.annotation.Nullable;
import static org.zalando.fauxpas.TryWith.tryWith;
final class ExtractRoute {
private ExtractRoute() {
}
static Route extractTo(@Nullable final ResponseExtractor extractor, final Capture capture) {
return (response, reader) ->
tryWith(response, ignored -> {
if (extractor == null) {
capture.capture(null);
} else {
capture.capture(extractor.extractData(response));
}
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy