Java Code Examples for org.springframework.http.MediaType#APPLICATION_STREAM_JSON_VALUE
The following examples show how to use
org.springframework.http.MediaType#APPLICATION_STREAM_JSON_VALUE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactiveController.java From Hands-On-Reactive-Programming-with-Reactor with MIT License | 5 votes |
@GetMapping(value = "/numbers1", produces = MediaType.APPLICATION_STREAM_JSON_VALUE) public Flux<Long> handleSeries1() { Flux<Long> fibonacciGenerator = Flux.generate(() -> Tuples.<Long, Long>of(0L, 1L), (state, sink) -> { if (state.getT1() < 0) sink.complete(); else sink.next(state.getT1()); System.out.println("numbers1 generated :"+state.getT1()); return Tuples.of(state.getT2(), state.getT1() + state.getT2()); }); return fibonacciGenerator; }
Example 2
Source File: EventController.java From spring-five-functional-reactive with Apache License 2.0 | 5 votes |
@GetMapping(path = "/events", produces = { // MediaType.APPLICATION_STREAM_JSON_VALUE, // MediaType.TEXT_EVENT_STREAM_VALUE // }) Flux<Event> streamEvents() { return eventRepository.findPeopleBy(); }
Example 3
Source File: UserController.java From Spring-Boot-Book with Apache License 2.0 | 4 votes |
@GetMapping(value = "/listdelay", produces = MediaType.APPLICATION_STREAM_JSON_VALUE) public Flux<User> getAlldelay() { return userRepository.findAll().delayElements(Duration.ofSeconds(1)); }
Example 4
Source File: ApiApi.java From staccato with Apache License 2.0 | 4 votes |
@GetMapping(path = "/search", produces = {MediaType.TEXT_EVENT_STREAM_VALUE, MediaType.APPLICATION_STREAM_JSON_VALUE}) Flux<Item> getItemsStream(@Valid SearchRequest searchRequest);
Example 5
Source File: ApiApi.java From staccato with Apache License 2.0 | 4 votes |
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE, produces = {MediaType.TEXT_EVENT_STREAM_VALUE, MediaType.APPLICATION_STREAM_JSON_VALUE}) Flux<Item> getItemsPostStream(@Valid @RequestBody SearchRequest searchRequest);
Example 6
Source File: ApiApi.java From staccato with Apache License 2.0 | 4 votes |
@PostMapping(value = "/search", consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}, produces = MediaType.APPLICATION_STREAM_JSON_VALUE) Mono<ItemCollection> getItemsFormPost(@Valid @ModelAttribute SearchRequest searchRequest);
Example 7
Source File: ReactiveController.java From webflux-streaming-demo with MIT License | 4 votes |
@GetMapping(value = "/test2", produces = MediaType.APPLICATION_STREAM_JSON_VALUE) public Flux<Pair> test2() { return exampleHandler.test2(); }
Example 8
Source File: PostController.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
@GetMapping(produces = MediaType.APPLICATION_STREAM_JSON_VALUE) public Flux<Post> stream() { return Flux.interval(Duration.ofSeconds(1L)).flatMap((oneSecond) -> this.posts.findAll()); }