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

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,​H>
org.springframework.integration.dsl.MessageHandlerSpec<S,​E>
org.springframework.integration.http.dsl.BaseHttpMessageHandlerSpec<S,​E>
Type Parameters:
S - the target BaseHttpMessageHandlerSpec implementation type.
E - the target AbstractHttpRequestExecutingMessageHandler implementation type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<E>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.dsl.ComponentsRegistration
Direct Known Subclasses:
HttpMessageHandlerSpec

public abstract class BaseHttpMessageHandlerSpec<S extends BaseHttpMessageHandlerSpec<S,​E>,​E extends AbstractHttpRequestExecutingMessageHandler>
extends org.springframework.integration.dsl.MessageHandlerSpec<S,​E>
implements org.springframework.integration.dsl.ComponentsRegistration
The base MessageHandlerSpec for AbstractHttpRequestExecutingMessageHandlers.
Since:
5.0
  • Field Summary

    Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    PARSER, target

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Constructor Description
    BaseHttpMessageHandlerSpec​(E handler)  
  • Method Summary

    Modifier and Type Method Description
    S charset​(java.lang.String charset)
    Specify the charset name to use for converting String-typed payloads to bytes.
    S encodingMode​(org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode encodingMode)
    Specify a DefaultUriBuilderFactory.EncodingMode for uri construction.
    S expectedResponseType​(java.lang.Class<?> expectedResponseType)
    Specify the expected response type for the REST request.
    S expectedResponseType​(org.springframework.core.ParameterizedTypeReference<?> expectedResponseType)
    Specify a ParameterizedTypeReference for the expected response type for the REST request.
    S expectedResponseTypeExpression​(org.springframework.expression.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.
    <P> S expectedResponseTypeFunction​(java.util.function.Function<org.springframework.messaging.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.
    protected S expectReply​(boolean expectReply)  
    S extractPayload​(boolean extractPayload)
    Specify whether the outbound message's payload should be extracted when preparing the request body.
    S extractResponseBody​(boolean extractResponseBody)
    The flag to extract a body of the ResponseEntity for reply message payload.
    java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()  
    S headerMapper​(org.springframework.integration.mapping.HeaderMapper<org.springframework.http.HttpHeaders> headerMapper)
    Set the HeaderMapper to use when mapping between HTTP headers and MessageHeaders.
    S httpMethod​(org.springframework.http.HttpMethod httpMethod)
    Specify the HttpMethod for requests.
    S httpMethodExpression​(org.springframework.expression.Expression httpMethodExpression)
    Specify the SpEL Expression to determine HttpMethod at runtime.
    <P> S httpMethodFunction​(java.util.function.Function<org.springframework.messaging.Message<P>,​?> httpMethodFunction)
    Specify a Function to determine HttpMethod at runtime.
    protected abstract boolean isClientSet()  
    S mappedRequestHeaders​(java.lang.String... patterns)
    Provide the pattern array for request headers to map.
    S mappedResponseHeaders​(java.lang.String... patterns)
    Provide the pattern array for response headers to map.
    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.
    S uriVariable​(java.lang.String variable, java.lang.String expression)
    Specify a value SpEL expression for the uri template variable.
    <P> S uriVariable​(java.lang.String variable, java.util.function.Function<org.springframework.messaging.Message<P>,​?> valueFunction)
    Specify a Function to evaluate a value for the uri template variable.
    S uriVariable​(java.lang.String variable, org.springframework.expression.Expression expression)
    Specify an Expression to evaluate a value for the uri template variable.
    S uriVariableExpressions​(java.util.Map<java.lang.String,​org.springframework.expression.Expression> uriVariableExpressions)
    Set the Map of URI variable expressions to evaluate against the outbound message when replacing the variable placeholders in a URI template.
    S uriVariablesExpression​(java.lang.String uriVariablesExpression)
    Specify a SpEL expression to evaluate a Map of URI variables at runtime against request message.
    S uriVariablesExpression​(org.springframework.expression.Expression uriVariablesExpression)
    Specify a SpEL expression to evaluate a Map of URI variables at runtime against request message.
    <P> S uriVariablesFunction​(java.util.function.Function<org.springframework.messaging.Message<P>,​java.util.Map<java.lang.String,​?>> uriVariablesFunction)
    Specify a Function to evaluate a Map of URI variables at runtime against request message.

    Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    _this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • expectReply

      protected S expectReply​(boolean expectReply)
    • encodingMode

      public S encodingMode​(org.springframework.web.util.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​(org.springframework.expression.Expression httpMethodExpression)
      Specify the SpEL Expression to determine HttpMethod at runtime.
      Parameters:
      httpMethodExpression - The method expression.
      Returns:
      the spec
    • httpMethodFunction

      public <P> S httpMethodFunction​(java.util.function.Function<org.springframework.messaging.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​(org.springframework.http.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​(java.lang.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​(java.lang.Class<?> expectedResponseType)
      Specify the expected response type for the REST request.
      Parameters:
      expectedResponseType - The expected type.
      Returns:
      the spec
    • expectedResponseType

      public S expectedResponseType​(org.springframework.core.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​(org.springframework.expression.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​(java.util.function.Function<org.springframework.messaging.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​(org.springframework.integration.mapping.HeaderMapper<org.springframework.http.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​(java.lang.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:
      DefaultHttpHeaderMapper.setOutboundHeaderNames(String[])
    • mappedResponseHeaders

      public S mappedResponseHeaders​(java.lang.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:
      DefaultHttpHeaderMapper.setInboundHeaderNames(String[])
    • uriVariableExpressions

      public S uriVariableExpressions​(java.util.Map<java.lang.String,​org.springframework.expression.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariableExpressions(Map)
    • uriVariable

      public S uriVariable​(java.lang.String variable, org.springframework.expression.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariableExpressions(Map), ValueExpression, LiteralExpression
    • uriVariable

      public S uriVariable​(java.lang.String variable, java.lang.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariableExpressions(Map)
    • uriVariable

      public <P> S uriVariable​(java.lang.String variable, java.util.function.Function<org.springframework.messaging.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariableExpressions(Map)
    • uriVariablesExpression

      public S uriVariablesExpression​(java.lang.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariablesExpression(Expression)
    • uriVariablesExpression

      public S uriVariablesExpression​(org.springframework.expression.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariablesExpression(Expression)
    • uriVariablesFunction

      public <P> S uriVariablesFunction​(java.util.function.Function<org.springframework.messaging.Message<P>,​java.util.Map<java.lang.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:
      AbstractHttpRequestExecutingMessageHandler.setUriVariablesExpression(Expression)
    • 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 java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface org.springframework.integration.dsl.ComponentsRegistration
    • isClientSet

      protected abstract boolean isClientSet()