Browse Source

Update references to HTTP service clients in docs

Closes gh-35522
pull/35535/head
rstoyanchev 3 months ago
parent
commit
e9e19f5ed7
  1. 2
      framework-docs/modules/ROOT/nav.adoc
  2. 22
      framework-docs/modules/ROOT/pages/integration/rest-clients.adoc
  3. 6
      framework-docs/modules/ROOT/pages/web/webflux-http-service-client.adoc
  4. 2
      framework-docs/modules/ROOT/pages/web/webflux-versioning.adoc
  5. 23
      framework-docs/modules/ROOT/pages/web/webflux/controller/ann-requestmapping.adoc
  6. 6
      framework-docs/modules/ROOT/pages/web/webmvc-client.adoc
  7. 2
      framework-docs/modules/ROOT/pages/web/webmvc-versioning.adoc
  8. 9
      framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-requestmapping.adoc
  9. 6
      framework-docs/src/main/java/org/springframework/docs/integration/resthttpserviceclient/customresolver/CustomHttpServiceArgumentResolver.java
  10. 6
      framework-docs/src/main/kotlin/org/springframework/docs/integration/resthttpserviceclient/customresolver/CustomHttpServiceArgumentResolver.kt
  11. 2
      spring-web/src/main/java/org/springframework/web/service/invoker/HttpRequestValues.java
  12. 4
      spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistry.java

2
framework-docs/modules/ROOT/nav.adoc

@ -314,7 +314,7 @@
*** xref:web/webflux-webclient/client-context.adoc[] *** xref:web/webflux-webclient/client-context.adoc[]
*** xref:web/webflux-webclient/client-synchronous.adoc[] *** xref:web/webflux-webclient/client-synchronous.adoc[]
*** xref:web/webflux-webclient/client-testing.adoc[] *** xref:web/webflux-webclient/client-testing.adoc[]
** xref:web/webflux-http-interface-client.adoc[] ** xref:web/webflux-http-service-client.adoc[]
** xref:web/webflux-websocket.adoc[] ** xref:web/webflux-websocket.adoc[]
** xref:web/webflux-test.adoc[] ** xref:web/webflux-test.adoc[]
** xref:rsocket.adoc[] ** xref:rsocket.adoc[]

22
framework-docs/modules/ROOT/pages/integration/rest-clients.adoc

@ -6,7 +6,7 @@ The Spring Framework provides the following choices for making calls to REST end
* xref:integration/rest-clients.adoc#rest-restclient[`RestClient`] -- synchronous client with a fluent API * xref:integration/rest-clients.adoc#rest-restclient[`RestClient`] -- synchronous client with a fluent API
* xref:integration/rest-clients.adoc#rest-webclient[`WebClient`] -- non-blocking, reactive client with fluent API * xref:integration/rest-clients.adoc#rest-webclient[`WebClient`] -- non-blocking, reactive client with fluent API
* xref:integration/rest-clients.adoc#rest-resttemplate[`RestTemplate`] -- synchronous client with template method API * xref:integration/rest-clients.adoc#rest-resttemplate[`RestTemplate`] -- synchronous client with template method API
* xref:integration/rest-clients.adoc#rest-http-interface[HTTP Interface Clients] -- annotated interface backed by generated proxy * xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service Clients] -- annotated interface backed by generated proxy
[[rest-restclient]] [[rest-restclient]]
@ -855,8 +855,8 @@ It can be used to migrate from the latter to the former.
|=== |===
[[rest-http-interface]] [[rest-http-service-client]]
== HTTP Interface Clients == HTTP Service Clients
You can define an HTTP Service as a Java interface with `@HttpExchange` methods, and use You can define an HTTP Service as a Java interface with `@HttpExchange` methods, and use
`HttpServiceProxyFactory` to create a client proxy from it for remote access over HTTP via `HttpServiceProxyFactory` to create a client proxy from it for remote access over HTTP via
@ -928,7 +928,7 @@ Now, you're ready to create client proxies:
// Use service methods for remote calls... // Use service methods for remote calls...
---- ----
[[rest-http-interface-method-parameters]] [[rest-http-service-client-method-parameters]]
=== Method Parameters === Method Parameters
`@HttpExchange` methods support flexible method signatures with the following inputs: `@HttpExchange` methods support flexible method signatures with the following inputs:
@ -1000,13 +1000,13 @@ parameter annotation) is set to `false`, or the parameter is marked optional as
`StreamingHttpOutputMessage.Body` that allows sending the request body by writing to an `StreamingHttpOutputMessage.Body` that allows sending the request body by writing to an
`OutputStream`. `OutputStream`.
[[rest-http-interface.custom-resolver]] [[rest-http-service-client.custom-resolver]]
=== Custom Arguments === Custom Arguments
You can configure a custom `HttpServiceArgumentResolver`. The example interface below You can configure a custom `HttpServiceArgumentResolver`. The example interface below
uses a custom `Search` method parameter type: uses a custom `Search` method parameter type:
include-code::./CustomHttpServiceArgumentResolver[tag=httpinterface,indent=0] include-code::./CustomHttpServiceArgumentResolver[tag=httpserviceclient,indent=0]
A custom argument resolver could be implemented like this: A custom argument resolver could be implemented like this:
@ -1021,7 +1021,7 @@ the use of more fine-grained method parameters for individual parts of the reque
[[rest-http-interface-return-values]] [[rest-http-service-client-return-values]]
=== Return Values === Return Values
The supported return values depend on the underlying client. The supported return values depend on the underlying client.
@ -1097,7 +1097,7 @@ underlying HTTP client, which operates at a lower level and provides more contro
`InputStream` or `ResponseEntity<InputStream>` that provides access to the raw response `InputStream` or `ResponseEntity<InputStream>` that provides access to the raw response
body content. body content.
[[rest-http-interface-exceptions]] [[rest-http-service-client-exceptions]]
=== Error Handling === Error Handling
To customize error handling for HTTP Service client proxies, you can configure the To customize error handling for HTTP Service client proxies, you can configure the
@ -1134,7 +1134,7 @@ documentation for each client, as well as the Javadoc of `defaultStatusHandler`
[[rest-http-interface-adapter-decorator]] [[rest-http-service-client-adapter-decorator]]
=== Decorating the Adapter === Decorating the Adapter
`HttpExchangeAdapter` and `ReactorHttpExchangeAdapter` are contracts that decouple HTTP `HttpExchangeAdapter` and `ReactorHttpExchangeAdapter` are contracts that decouple HTTP
@ -1162,8 +1162,8 @@ built-in decorators to suppress 404 exceptions and return a `ResponseEntity` wit
[[rest-http-interface-group-config]] [[rest-http-service-client-group-config]]
=== HTTP Interface Groups === HTTP Service Groups
It's trivial to create client proxies with `HttpServiceProxyFactory`, but to have them It's trivial to create client proxies with `HttpServiceProxyFactory`, but to have them
declared as beans leads to repetitive configuration. You may also have multiple declared as beans leads to repetitive configuration. You may also have multiple

6
framework-docs/modules/ROOT/pages/web/webflux-http-interface-client.adoc → framework-docs/modules/ROOT/pages/web/webflux-http-service-client.adoc

@ -1,9 +1,9 @@
[[webflux-http-interface-client]] [[webflux-http-service-client]]
= HTTP Interface Client = HTTP Service Client
The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP The Spring Frameworks lets you define an HTTP service as a Java interface with HTTP
exchange methods. You can then generate a proxy that implements this interface and exchange methods. You can then generate a proxy that implements this interface and
performs the exchanges. This helps to simplify HTTP remote access and provides additional performs the exchanges. This helps to simplify HTTP remote access and provides additional
flexibility for to choose an API style such as synchronous or reactive. flexibility for to choose an API style such as synchronous or reactive.
See xref:integration/rest-clients.adoc#rest-http-interface[REST Endpoints] for details. See xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service Clients] for details.

2
framework-docs/modules/ROOT/pages/web/webflux-versioning.adoc

@ -17,7 +17,7 @@ to annotated controller methods with an API version
to functional endpoints with an API version to functional endpoints with an API version
Client support for API versioning is available also in `RestClient`, `WebClient`, and Client support for API versioning is available also in `RestClient`, `WebClient`, and
xref:integration/rest-clients.adoc#rest-http-interface[HTTP Service] clients, as well as xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service] clients, as well as
for testing in `WebTestClient`. for testing in `WebTestClient`.

23
framework-docs/modules/ROOT/pages/web/webflux/controller/ann-requestmapping.adoc

@ -629,17 +629,16 @@ Kotlin::
== `@HttpExchange` == `@HttpExchange`
[.small]#xref:web/webmvc/mvc-controller/ann-requestmapping.adoc#mvc-ann-httpexchange-annotation[See equivalent in the Servlet stack]# [.small]#xref:web/webmvc/mvc-controller/ann-requestmapping.adoc#mvc-ann-httpexchange-annotation[See equivalent in the Servlet stack]#
While the main purpose of `@HttpExchange` is to abstract HTTP client code with a While the main purpose of `@HttpExchange` is for an HTTP Service
generated proxy, the xref:integration/rest-clients.adoc#rest-http-service-client[client with a generated proxy],
xref:integration/rest-clients.adoc#rest-http-interface[HTTP Interface] on which the HTTP Service interface on which such annotations are placed is a contract neutral
such annotations are placed is a contract neutral to client vs server use. to client vs server use. In addition to simplifying client code, there are also cases
In addition to simplifying client code, there are also cases where an HTTP Interface where an HTTP Service interface may be a convenient way for servers to expose their
may be a convenient way for servers to expose their API for client access. This leads API for client access. This leads to increased coupling between client and server and
to increased coupling between client and server and is often not a good choice, is often not a good choice, especially for public API's, but may be exactly the goal
especially for public API's, but may be exactly the goal for an internal API. for an internal API. It is an approach commonly used in Spring Cloud, and it is why
It is an approach commonly used in Spring Cloud, and it is why `@HttpExchange` is `@HttpExchange` is supported as an alternative to `@RequestMapping` for server side
supported as an alternative to `@RequestMapping` for server side handling in handling in controller classes.
controller classes.
For example: For example:
@ -710,5 +709,5 @@ path, and content types.
For method parameters and returns values, generally, `@HttpExchange` supports a For method parameters and returns values, generally, `@HttpExchange` supports a
subset of the method parameters that `@RequestMapping` does. Notably, it excludes any subset of the method parameters that `@RequestMapping` does. Notably, it excludes any
server-side specific parameter types. For details, see the list for server-side specific parameter types. For details, see the list for
xref:integration/rest-clients.adoc#rest-http-interface-method-parameters[@HttpExchange] and xref:integration/rest-clients.adoc#rest-http-service-client-method-parameters[@HttpExchange] and
xref:web/webflux/controller/ann-methods/arguments.adoc[@RequestMapping]. xref:web/webflux/controller/ann-methods/arguments.adoc[@RequestMapping].

6
framework-docs/modules/ROOT/pages/web/webmvc-client.adoc

@ -30,12 +30,12 @@ libraries.
See xref:integration/rest-clients.adoc#rest-resttemplate[`RestTemplate`] for details. See xref:integration/rest-clients.adoc#rest-resttemplate[`RestTemplate`] for details.
[[webmvc-http-interface]] [[webmvc-http-service-client]]
== HTTP Interface == HTTP Service Client
The Spring Framework lets you define an HTTP service as a Java interface with HTTP The Spring Framework lets you define an HTTP service as a Java interface with HTTP
exchange methods. You can then generate a proxy that implements this interface and exchange methods. You can then generate a proxy that implements this interface and
performs the exchanges. This helps to simplify HTTP remote access and provides additional performs the exchanges. This helps to simplify HTTP remote access and provides additional
flexibility for choosing an API style such as synchronous or reactive. flexibility for choosing an API style such as synchronous or reactive.
See xref:integration/rest-clients.adoc#rest-http-interface[HTTP Interface] for details. See xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service Client] for details.

2
framework-docs/modules/ROOT/pages/web/webmvc-versioning.adoc

@ -16,7 +16,7 @@ to annotated controller methods with an API version
to functional endpoints with an API version to functional endpoints with an API version
Client support for API versioning is available also in `RestClient`, `WebClient`, and Client support for API versioning is available also in `RestClient`, `WebClient`, and
xref:integration/rest-clients.adoc#rest-http-interface[HTTP Service] clients, as well as xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service] clients, as well as
for testing in MockMvc and `WebTestClient`. for testing in MockMvc and `WebTestClient`.

9
framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-requestmapping.adoc

@ -659,10 +659,9 @@ Kotlin::
[.small]#xref:web/webflux/controller/ann-requestmapping.adoc#webflux-ann-httpexchange-annotation[See equivalent in the Reactive stack]# [.small]#xref:web/webflux/controller/ann-requestmapping.adoc#webflux-ann-httpexchange-annotation[See equivalent in the Reactive stack]#
While the main purpose of `@HttpExchange` is to abstract HTTP client code with a While the main purpose of `@HttpExchange` is to abstract HTTP client code with a
generated proxy, the generated proxy, the interface on which such annotations are placed is a contract neutral
xref:integration/rest-clients.adoc#rest-http-interface[HTTP Interface] on which to client vs server use. In addition to simplifying client code, there are also cases
such annotations are placed is a contract neutral to client vs server use. where an xref:integration/rest-clients.adoc#rest-http-service-client[HTTP Service Client]
In addition to simplifying client code, there are also cases where an HTTP Interface
may be a convenient way for servers to expose their API for client access. This leads may be a convenient way for servers to expose their API for client access. This leads
to increased coupling between client and server and is often not a good choice, to increased coupling between client and server and is often not a good choice,
especially for public API's, but may be exactly the goal for an internal API. especially for public API's, but may be exactly the goal for an internal API.
@ -739,7 +738,7 @@ path, and content types.
For method parameters and returns values, generally, `@HttpExchange` supports a For method parameters and returns values, generally, `@HttpExchange` supports a
subset of the method parameters that `@RequestMapping` does. Notably, it excludes any subset of the method parameters that `@RequestMapping` does. Notably, it excludes any
server-side specific parameter types. For details, see the list for server-side specific parameter types. For details, see the list for
xref:integration/rest-clients.adoc#rest-http-interface-method-parameters[@HttpExchange] and xref:integration/rest-clients.adoc#rest-http-service-client-method-parameters[@HttpExchange] and
xref:web/webmvc/mvc-controller/ann-methods/arguments.adoc[@RequestMapping]. xref:web/webmvc/mvc-controller/ann-methods/arguments.adoc[@RequestMapping].
`@HttpExchange` also supports a `headers()` parameter which accepts `"name=value"`-like `@HttpExchange` also supports a `headers()` parameter which accepts `"name=value"`-like

6
framework-docs/src/main/java/org/springframework/docs/integration/resthttpinterface/customresolver/CustomHttpServiceArgumentResolver.java → framework-docs/src/main/java/org/springframework/docs/integration/resthttpserviceclient/customresolver/CustomHttpServiceArgumentResolver.java

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.docs.integration.resthttpinterface.customresolver; package org.springframework.docs.integration.resthttpserviceclient.customresolver;
import java.util.List; import java.util.List;
@ -28,14 +28,14 @@ import org.springframework.web.service.invoker.HttpServiceProxyFactory;
public class CustomHttpServiceArgumentResolver { public class CustomHttpServiceArgumentResolver {
// tag::httpinterface[] // tag::httpserviceclient[]
public interface RepositoryService { public interface RepositoryService {
@GetExchange("/repos/search") @GetExchange("/repos/search")
List<Repository> searchRepository(Search search); List<Repository> searchRepository(Search search);
} }
// end::httpinterface[] // end::httpserviceclient[]
class Sample { class Sample {

6
framework-docs/src/main/kotlin/org/springframework/docs/integration/resthttpinterface/customresolver/CustomHttpServiceArgumentResolver.kt → framework-docs/src/main/kotlin/org/springframework/docs/integration/resthttpserviceclient/customresolver/CustomHttpServiceArgumentResolver.kt

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.docs.integration.resthttpinterface.customresolver package org.springframework.docs.integration.resthttpserviceclient.customresolver
import org.springframework.core.MethodParameter import org.springframework.core.MethodParameter
import org.springframework.web.client.RestClient import org.springframework.web.client.RestClient
@ -26,14 +26,14 @@ import org.springframework.web.service.invoker.HttpServiceProxyFactory
class CustomHttpServiceArgumentResolver { class CustomHttpServiceArgumentResolver {
// tag::httpinterface[] // tag::httpserviceclient[]
interface RepositoryService { interface RepositoryService {
@GetExchange("/repos/search") @GetExchange("/repos/search")
fun searchRepository(search: Search): List<Repository> fun searchRepository(search: Search): List<Repository>
} }
// end::httpinterface[] // end::httpserviceclient[]
class Sample { class Sample {
fun sample() { fun sample() {

2
spring-web/src/main/java/org/springframework/web/service/invoker/HttpRequestValues.java

@ -127,7 +127,7 @@ public class HttpRequestValues {
/** /**
* Return the {@link UriBuilderFactory} to expand * Return the {@link UriBuilderFactory} to expand
* the {@link HttpRequestValues#uriTemplate} and {@link #getUriVariables()} with. * the {@link HttpRequestValues#uriTemplate} and {@link #getUriVariables()} with.
* <p>The {@link UriBuilderFactory} is passed into the HTTP interface method * <p>The {@link UriBuilderFactory} is passed into the HTTP Service client method
* in order to override the UriBuilderFactory (and its baseUrl) used by the * in order to override the UriBuilderFactory (and its baseUrl) used by the
* underlying client. * underlying client.
* @since 6.1 * @since 6.1

4
spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistry.java

@ -33,7 +33,7 @@ public interface HttpServiceProxyRegistry {
* Return an HTTP service client from any group as long as there is only one * Return an HTTP service client from any group as long as there is only one
* client of this type across all groups. * client of this type across all groups.
* @param httpServiceType the type of client * @param httpServiceType the type of client
* @param <P> the type of HTTP interface client * @param <P> the type of HTTP service client
* @return the matched client * @return the matched client
* @throws IllegalArgumentException if there is no client of the given type, * @throws IllegalArgumentException if there is no client of the given type,
* or there is more than one client of the given type. * or there is more than one client of the given type.
@ -44,7 +44,7 @@ public interface HttpServiceProxyRegistry {
* Return an HTTP service client from the named group. * Return an HTTP service client from the named group.
* @param groupName the name of the group * @param groupName the name of the group
* @param httpServiceType the type of client * @param httpServiceType the type of client
* @param <P> the type of HTTP interface client * @param <P> the type of HTTP service client
* @return the matched client * @return the matched client
* @throws IllegalArgumentException if there is no matching client. * @throws IllegalArgumentException if there is no matching client.
*/ */

Loading…
Cancel
Save