@Test public void test_8() throws Exception { final ObjectMapper objectMapper = new ObjectMapper(); WebClient .create("https: .get() .retrieve() .bodyToMono(String.class) .flatMap(s -> Mono.fromCallable(() -> objectMapper.readValue(s, Response.class))) .flatMapIterable(Response::getBloggers) .map(Blog::toString) .doOnNext(System.out::println) .blockLast(); }
private String get(URL url) throws IOException { final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); if (conn.getResponseCode() == HttpStatus.MOVED_PERMANENTLY.value()) { return get(new URL(conn.getHeaderField("Location"))); } try (final InputStreamReader reader = new InputStreamReader(conn.getInputStream(), UTF_8)) { return CharStreams.toString(reader); } }
FeedReader { private String get(URL url) throws IOException { final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); if (conn.getResponseCode() == HttpStatus.MOVED_PERMANENTLY.value()) { return get(new URL(conn.getHeaderField("Location"))); } try (final InputStreamReader reader = new InputStreamReader(conn.getInputStream(), UTF_8)) { return CharStreams.toString(reader); } } }
FeedReader { private String get(URL url) throws IOException { final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); if (conn.getResponseCode() == HttpStatus.MOVED_PERMANENTLY.value()) { return get(new URL(conn.getHeaderField("Location"))); } try (final InputStreamReader reader = new InputStreamReader(conn.getInputStream(), UTF_8)) { return CharStreams.toString(reader); } }  }
FeedReader { private String get(URL url) throws IOException { final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); if (conn.getResponseCode() == HttpStatus.MOVED_PERMANENTLY.value()) { return get(new URL(conn.getHeaderField("Location"))); } try (final InputStreamReader reader = new InputStreamReader(conn.getInputStream(), UTF_8)) { return CharStreams.toString(reader); } }  List<SyndEntry> fetch(URL url); }
FeedReader { private String get(URL url) throws IOException { final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); if (conn.getResponseCode() == HttpStatus.MOVED_PERMANENTLY.value()) { return get(new URL(conn.getHeaderField("Location"))); } try (final InputStreamReader reader = new InputStreamReader(conn.getInputStream(), UTF_8)) { return CharStreams.toString(reader); } }  List<SyndEntry> fetch(URL url);  }