Merge pull request #41948 from ritzykey

* pr/41948:
  Polish "Harmonize web handler code sample"
  Harmonize web handler code sample

Closes gh-41948
This commit is contained in:
Stéphane Nicoll 2024-08-20 08:43:38 +02:00
commit 1a2d1c510b
3 changed files with 12 additions and 15 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,18 +24,15 @@ import org.springframework.web.servlet.function.ServerResponse;
public class MyUserHandler { public class MyUserHandler {
public ServerResponse getUser(ServerRequest request) { public ServerResponse getUser(ServerRequest request) {
/**/ /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
public ServerResponse getUserCustomers(ServerRequest request) { public ServerResponse getUserCustomers(ServerRequest request) {
/**/ /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
public ServerResponse deleteUser(ServerRequest request) { public ServerResponse deleteUser(ServerRequest request) {
/**/ /**/ return ServerResponse.ok().build();
return ServerResponse.ok().build();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,15 +26,15 @@ import reactor.core.publisher.Mono
class MyUserHandler { class MyUserHandler {
fun getUser(request: ServerRequest?): Mono<ServerResponse> { fun getUser(request: ServerRequest?): Mono<ServerResponse> {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
fun getUserCustomers(request: ServerRequest?): Mono<ServerResponse> { fun getUserCustomers(request: ServerRequest?): Mono<ServerResponse> {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
fun deleteUser(request: ServerRequest?): Mono<ServerResponse> { fun deleteUser(request: ServerRequest?): Mono<ServerResponse> {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,15 +25,15 @@ import org.springframework.web.servlet.function.ServerResponse
class MyUserHandler { class MyUserHandler {
fun getUser(request: ServerRequest?): ServerResponse { fun getUser(request: ServerRequest?): ServerResponse {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
fun getUserCustomers(request: ServerRequest?): ServerResponse { fun getUserCustomers(request: ServerRequest?): ServerResponse {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
fun deleteUser(request: ServerRequest?): ServerResponse { fun deleteUser(request: ServerRequest?): ServerResponse {
return ServerResponse.ok().build() /**/ return ServerResponse.ok().build()
} }
} }