@Override public String pathVariable(String name) { return this.delegate.pathVariable(name); }
@Test public void pathVariable() { String name = "foo"; String value = "bar"; when(mockRequest.pathVariable(name)).thenReturn(value); assertEquals(value, wrapper.pathVariable(name)); }
@Override public String pathVariable(String name) { return this.request.pathVariable(name); }
public Mono<ServerResponse> getLocation(final ServerRequest request) { return Mono.just(request.pathVariable(ADDRESS)) .transform(this::buildResponse) .onErrorResume(errorHandler::throwableError); }
public Mono<ServerResponse> forZone(ServerRequest request) { String id = request.pathVariable("id"); return ServerResponse.ok().contentType(MediaType.APPLICATION_STREAM_JSON) .body(this.content.get(id), ElectricityMeasure.class); }
public Mono<ServerResponse> get(ServerRequest req) { return this.posts.findById(Long.valueOf(req.pathVariable("id"))) .flatMap(post -> ServerResponse.ok().body(Mono.just(post), Post.class)) .switchIfEmpty(ServerResponse.notFound().build()); } }
public Mono<ServerResponse> deleteUser(ServerRequest request) { String id = request.pathVariable("id"); return ServerResponse.ok().build(userReactiveRepository.deleteById(id)); }
public Mono<ServerResponse> delete(ServerRequest req) { return ServerResponse.noContent().build(this.posts.deleteById(req.pathVariable("id"))); }
public Mono<ServerResponse> state(ServerRequest request) { String appId = request.pathVariable("id"); PregelGraphAlgorithm<Long, ?, ?, ?> algorithm = algorithms.get(appId); return ServerResponse.ok() .contentType(MediaType.APPLICATION_JSON) .body(Mono.just(new GraphAlgorithmStatus(algorithm.state())), GraphAlgorithmStatus.class); }
public Mono<ServerResponse> get(ServerRequest req) { return this.posts.findById(req.pathVariable("id")) .flatMap(post -> ServerResponse.ok().body(Mono.just(post), Post.class)) .switchIfEmpty(ServerResponse.notFound().build()); }
public Mono<ServerResponse> delete(ServerRequest request) { List<String> appIdHeaders = request.headers().header(X_KGRAPH_APPID); String appId = request.pathVariable("id"); PregelGraphAlgorithm<Long, ?, ?, ?> algorithm = algorithms.remove(appId); algorithm.close(); return proxyDelete(appIdHeaders.isEmpty() ? group.getCurrentMembers().keySet() : Collections.emptySet(), appId) .then(ServerResponse.noContent().build()); }
public Mono<ServerResponse> get(ServerRequest req) { return this.posts.findById(Long.valueOf(req.pathVariable("id"))) .flatMap(post -> ok().syncBody(post)) .switchIfEmpty(notFound().build()); } }
public Mono<ServerResponse> get(ServerRequest req) { return this.posts.findById(req.pathVariable("id")) .flatMap(post -> ServerResponse.ok().body(Mono.just(post), Post.class)) .switchIfEmpty(ServerResponse.notFound().build()); }
public Mono<ServerResponse> get(ServerRequest req) { return this.posts.findById(req.pathVariable("id")) .flatMap(post -> ServerResponse.ok().body(Mono.just(post), Post.class)) .switchIfEmpty(ServerResponse.notFound().build()); }
public Mono<ServerResponse> handleGetUserById(ServerRequest request) { return userRepository.getUserById(request.pathVariable("id")) .flatMap(user -> ServerResponse.ok().body(Mono.just(user), User.class)) .switchIfEmpty(ServerResponse.notFound().build()); }
public Mono<ServerResponse> delete(ServerRequest request) { String id = request.pathVariable("id"); Mono<Void> result = restaurantRepository.deleteById(id); return ok().contentType(APPLICATION_JSON_UTF8).build(result); } }
public Mono<ServerResponse> get(ServerRequest request) { String id = request.pathVariable("id"); Mono<Restaurant> result = restaurantRepository.findById(id); return ok().contentType(APPLICATION_JSON_UTF8).body(result, Restaurant.class); }
public Mono<ServerResponse> getPerson(ServerRequest request) { int personId = Integer.valueOf(request.pathVariable("id")); Mono<ServerResponse> notFound = ServerResponse.notFound().build(); Mono<Person> personMono = this.repository.getPerson(personId); return personMono .flatMap(person -> ServerResponse.ok().contentType(APPLICATION_JSON).body(fromObject(person))) .switchIfEmpty(notFound); }
public Mono<ServerResponse> getUserById(ServerRequest request) { Mono<User> userMono = userReactiveRepository.findById(request.pathVariable("id")); Mono<ServerResponse> notFount = ServerResponse.notFound().build(); return userMono.flatMap(user -> ServerResponse.ok() .contentType(MediaType.APPLICATION_JSON_UTF8) .body(fromObject(user))) .switchIfEmpty(notFount); }
@Bean RouterFunction<?> routes(BookRepository br) { return route(GET("/books"), req -> ok().body(br.findAll(), Book.class)) .andRoute(GET("/books/{author}"), req -> ok().body(br.findByAuthor(req.pathVariable("author")), Book.class)); } //@formatter:on