Class HttpServiceProxyFactory

java.lang.Object
org.springframework.web.service.invoker.HttpServiceProxyFactory
All Implemented Interfaces:
Aware, InitializingBean, EmbeddedValueResolverAware

public final class HttpServiceProxyFactory extends Object implements InitializingBean, EmbeddedValueResolverAware
Factory to create a client proxy from an HTTP service interface with @HttpExchange methods.

To create an instance, use static methods to obtain a Builder.

Since:
6.0
Author:
Rossen Stoyanchev
See Also:
  • Constructor Details

    • HttpServiceProxyFactory

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public HttpServiceProxyFactory(HttpClientAdapter clientAdapter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Create an instance with the underlying HTTP client to use.
      Parameters:
      clientAdapter - an adapter for the client
  • Method Details

    • addCustomArgumentResolver

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void addCustomArgumentResolver(HttpServiceArgumentResolver resolver)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Register a custom argument resolver, invoked ahead of default resolvers.
      Parameters:
      resolver - the resolver to add
    • setCustomArgumentResolvers

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void setCustomArgumentResolvers(List<HttpServiceArgumentResolver> resolvers)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Set the custom argument resolvers to use, ahead of default resolvers.
      Parameters:
      resolvers - the resolvers to use
    • setConversionService

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void setConversionService(ConversionService conversionService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Set the ConversionService to use where input values need to be formatted as Strings.

      By default this is DefaultFormattingConversionService.

    • setEmbeddedValueResolver

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void setEmbeddedValueResolver(StringValueResolver resolver)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Set the StringValueResolver to use for resolving placeholders and expressions in HttpExchange.url().
      Specified by:
      setEmbeddedValueResolver in interface EmbeddedValueResolverAware
      Parameters:
      resolver - the resolver to use
    • setReactiveAdapterRegistry

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Set the ReactiveAdapterRegistry to use to support different asynchronous types for HTTP service method return values.

      By default this is ReactiveAdapterRegistry.getSharedInstance().

    • setBlockTimeout

      @Deprecated(since="6.0.0-RC2", forRemoval=true) public void setBlockTimeout(Duration blockTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in favor of using the Builder to initialize the HttpServiceProxyFactory instance.
      Configure how long to wait for a response for an HTTP service method with a synchronous (blocking) method signature.

      By default this is 5 seconds.

      Parameters:
      blockTimeout - the timeout value
    • afterPropertiesSet

      @Deprecated public void afterPropertiesSet() throws Exception
      Deprecated.
      Description copied from interface: InitializingBean
      Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

      This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
    • createClient

      public <S> S createClient(Class<S> serviceType)
      Return a proxy that implements the given HTTP service interface to perform HTTP requests and retrieve responses through an HTTP client.
      Type Parameters:
      S - the HTTP service type
      Parameters:
      serviceType - the HTTP service to create a proxy for
      Returns:
      the created proxy
    • builder

      public static HttpServiceProxyFactory.Builder builder(HttpClientAdapter clientAdapter)
      Return an HttpServiceProxyFactory builder, initialized with the given client.
    • builder

      public static HttpServiceProxyFactory.Builder builder()
      Return an HttpServiceProxyFactory builder.