Class BaseHttpMessageHandlerSpec<S extends BaseHttpMessageHandlerSpec<S,E>,E extends AbstractHttpRequestExecutingMessageHandler>

Type Parameters:
S - the target BaseHttpMessageHandlerSpec implementation type.
E - the target AbstractHttpRequestExecutingMessageHandler implementation type.
All Implemented Interfaces:
DisposableBean, FactoryBean<E>, InitializingBean, Lifecycle, Phased, SmartLifecycle, ComponentsRegistration
Direct Known Subclasses:
HttpMessageHandlerSpec, WebFluxMessageHandlerSpec

public abstract class BaseHttpMessageHandlerSpec<S extends BaseHttpMessageHandlerSpec<S,E>,E extends AbstractHttpRequestExecutingMessageHandler> extends MessageHandlerSpec<S,E> implements ComponentsRegistration
Since:
5.0
Author:
Artem Bilan, Shiliang Li
  • Constructor Details

    • BaseHttpMessageHandlerSpec

      public BaseHttpMessageHandlerSpec(E handler)
  • Method Details

    • expectReply

      protected S expectReply(boolean expectReply)
    • encodingMode

      public S encodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode)
      Specify a DefaultUriBuilderFactory.EncodingMode for uri construction.
      Parameters:
      encodingMode - to use for uri construction.
      Returns:
      the spec
      Since:
      5.3
    • httpMethodExpression

      public S httpMethodExpression(Expression httpMethodExpression)
      Specify the SpEL Expression to determine HttpMethod at runtime.
      Parameters:
      httpMethodExpression - The method expression.
      Returns:
      the spec
    • httpMethodFunction

      public <P> S httpMethodFunction(Function<Message<P>,?> httpMethodFunction)
      Specify a Function to determine HttpMethod at runtime.
      Type Parameters:
      P - the payload type.
      Parameters:
      httpMethodFunction - The HTTP method Function.
      Returns:
      the spec
    • httpMethod

      public S httpMethod(HttpMethod httpMethod)
      Specify the HttpMethod for requests. The default method is POST.
      Parameters:
      httpMethod - the HttpMethod to use.
      Returns:
      the spec
    • extractPayload

      public S extractPayload(boolean extractPayload)
      Specify whether the outbound message's payload should be extracted when preparing the request body. Otherwise, the Message instance itself is serialized. The default value is true.
      Parameters:
      extractPayload - true if the payload should be extracted.
      Returns:
      the spec
    • charset

      public S charset(String charset)
      Specify the charset name to use for converting String-typed payloads to bytes. The default is UTF-8.
      Parameters:
      charset - The charset.
      Returns:
      the spec
    • expectedResponseType

      public S expectedResponseType(Class<?> expectedResponseType)
      Specify the expected response type for the REST request.
      Parameters:
      expectedResponseType - The expected type.
      Returns:
      the spec
    • expectedResponseType

      public S expectedResponseType(ParameterizedTypeReference<?> expectedResponseType)
      Specify a ParameterizedTypeReference for the expected response type for the REST request.
      Parameters:
      expectedResponseType - The ParameterizedTypeReference for expected type.
      Returns:
      the spec
    • expectedResponseTypeExpression

      public S expectedResponseTypeExpression(Expression expectedResponseTypeExpression)
      Specify a SpEL Expression to determine the type for the expected response The returned value of the expression could be an instance of Class or String representing a fully qualified class name.
      Parameters:
      expectedResponseTypeExpression - The expected response type expression.
      Returns:
      the spec
    • expectedResponseTypeFunction

      public <P> S expectedResponseTypeFunction(Function<Message<P>,?> expectedResponseTypeFunction)
      Specify a Function to determine the type for the expected response The returned value of the expression could be an instance of Class or String representing a fully qualified class name.
      Type Parameters:
      P - the payload type.
      Parameters:
      expectedResponseTypeFunction - The expected response type Function.
      Returns:
      the spec
    • headerMapper

      public S headerMapper(HeaderMapper<HttpHeaders> headerMapper)
      Set the HeaderMapper to use when mapping between HTTP headers and MessageHeaders.
      Parameters:
      headerMapper - The header mapper.
      Returns:
      the spec
    • mappedRequestHeaders

      public S mappedRequestHeaders(String... patterns)
      Provide the pattern array for request headers to map.
      Parameters:
      patterns - the patterns for request headers to map.
      Returns:
      the spec
      See Also:
    • mappedResponseHeaders

      public S mappedResponseHeaders(String... patterns)
      Provide the pattern array for response headers to map.
      Parameters:
      patterns - the patterns for response headers to map.
      Returns:
      the current Spec.
      See Also:
    • uriVariableExpressions

      public S uriVariableExpressions(Map<String,Expression> uriVariableExpressions)
      Set the Map of URI variable expressions to evaluate against the outbound message when replacing the variable placeholders in a URI template.
      Parameters:
      uriVariableExpressions - The URI variable expressions.
      Returns:
      the current Spec.
      See Also:
    • uriVariable

      public S uriVariable(String variable, Expression expression)
      Specify an Expression to evaluate a value for the uri template variable.
      Parameters:
      variable - the uri template variable.
      expression - the expression to evaluate value for te uri template variable.
      Returns:
      the current Spec.
      See Also:
    • uriVariable

      public S uriVariable(String variable, String expression)
      Specify a value SpEL expression for the uri template variable.
      Parameters:
      variable - the uri template variable.
      expression - the expression to evaluate value for te uri template variable.
      Returns:
      the current Spec.
      See Also:
    • uriVariable

      public <P> S uriVariable(String variable, Function<Message<P>,?> valueFunction)
      Specify a Function to evaluate a value for the uri template variable.
      Type Parameters:
      P - the payload type.
      Parameters:
      variable - the uri template variable.
      valueFunction - the Function to evaluate a value for the uri template variable.
      Returns:
      the current Spec.
      See Also:
    • uriVariablesExpression

      public S uriVariablesExpression(String uriVariablesExpression)
      Specify a SpEL expression to evaluate a Map of URI variables at runtime against request message.
      Parameters:
      uriVariablesExpression - to use.
      Returns:
      the current Spec.
      See Also:
    • uriVariablesExpression

      public S uriVariablesExpression(Expression uriVariablesExpression)
      Specify a SpEL expression to evaluate a Map of URI variables at runtime against request message.
      Parameters:
      uriVariablesExpression - to use.
      Returns:
      the current Spec.
      See Also:
    • uriVariablesFunction

      public <P> S uriVariablesFunction(Function<Message<P>,Map<String,?>> uriVariablesFunction)
      Specify a Function to evaluate a Map of URI variables at runtime against request message.
      Type Parameters:
      P - the payload type.
      Parameters:
      uriVariablesFunction - the Function to use.
      Returns:
      the current Spec.
      See Also:
    • transferCookies

      public S transferCookies(boolean transferCookies)
      Set to true if you wish Set-Cookie header in response to be transferred as Cookie header in subsequent interaction for a message. Defaults to false.
      Parameters:
      transferCookies - the transferCookies to set.
      Returns:
      the current Spec.
    • extractResponseBody

      public S extractResponseBody(boolean extractResponseBody)
      The flag to extract a body of the ResponseEntity for reply message payload. Defaults to true.
      Parameters:
      extractResponseBody - produce a reply message with a whole ResponseEntity or just its body.
      Returns:
      the current Spec.
      Since:
      5.5
    • getComponentsToRegister

      public Map<Object,String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface ComponentsRegistration
    • isClientSet

      protected abstract boolean isClientSet()