Class HttpRequestExecutingMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandler
org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler
- All Implemented Interfaces:
- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Ordered,- ExpressionCapable,- Orderable,- MessageProducer,- HeaderPropagationAware,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
A 
MessageHandler
 implementation that executes HTTP requests by delegating
 to a RestTemplate instance. If the 'expectReply' flag is set to true (the default)
 then a reply Message will be generated from the HTTP response. If that response contains
 a body, it will be used as the reply Message's payload. Otherwise the reply Message's
 payload will contain the response status as an instance of the
 HttpStatus enum.
 When there is a response body, the HttpStatus enum
 instance will instead be
 copied to the MessageHeaders of the reply. In both cases, the response headers will
 be mapped to the reply Message's headers by this handler's
 HeaderMapper instance.- Since:
- 2.0
- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Gunnar Hillert, Artem Bilan, Wallace Wadge, Shiliang Li
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerAbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandleruriFactoryFields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandlermessagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a handler that will send requests to the provided URI.HttpRequestExecutingMessageHandler(String uri, RestTemplate restTemplate) Create a handler that will send requests to the provided URI using a provided RestTemplate.Create a handler that will send requests to the provided URI.HttpRequestExecutingMessageHandler(Expression uriExpression) Create a handler that will send requests to the provided URI Expression.HttpRequestExecutingMessageHandler(Expression uriExpression, RestTemplate restTemplate) 4 Create a handler that will send requests to the provided URI using a provided RestTemplate.
- 
Method SummaryModifier and TypeMethodDescriptionprotected Objectexchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String, ?> uriVariables) Subclasses may implement this method to provide component type information.voidsetEncodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode) Set the encoding mode to use.voidsetErrorHandler(ResponseErrorHandler errorHandler) Set theResponseErrorHandlerfor the underlyingRestTemplate.voidsetMessageConverters(List<HttpMessageConverter<?>> messageConverters) Set a list ofHttpMessageConverters to be used by the underlyingRestTemplate.voidsetRequestFactory(ClientHttpRequestFactory requestFactory) Set theClientHttpRequestFactoryfor the underlyingRestTemplate.Methods inherited from class org.springframework.integration.http.outbound.AbstractHttpRequestExecutingMessageHandlerdoInit, evaluateTypeFromExpression, getIntegrationPatternType, getReply, handleRequestMessage, isExpectReply, mapHeaders, setCharset, setExpectedResponseType, setExpectedResponseTypeExpression, setExpectReply, setExtractPayload, setExtractResponseBody, setHeaderMapper, setHttpMethod, setHttpMethodExpression, setTransferCookies, setTrustedSpel, setUriVariableExpressions, setUriVariablesExpressionMethods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerdoInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandleraddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
HttpRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI.- Parameters:
- uri- The URI.
 
- 
HttpRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI.- Parameters:
- uri- The URI.
 
- 
HttpRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI Expression.- Parameters:
- uriExpression- The URI expression.
 
- 
HttpRequestExecutingMessageHandlerCreate a handler that will send requests to the provided URI using a provided RestTemplate.- Parameters:
- uri- The URI.
- restTemplate- The rest template.
 
- 
HttpRequestExecutingMessageHandlerpublic HttpRequestExecutingMessageHandler(Expression uriExpression, @Nullable RestTemplate restTemplate) 4 Create a handler that will send requests to the provided URI using a provided RestTemplate.- Parameters:
- uriExpression- A SpEL Expression that can be resolved against the message object and- BeanFactory.
- restTemplate- The rest template.
 
 
- 
- 
Method Details- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessageHandlerSupport
 
- 
setErrorHandlerSet theResponseErrorHandlerfor the underlyingRestTemplate.- Parameters:
- errorHandler- The error handler.
- See Also:
 
- 
setMessageConvertersSet a list ofHttpMessageConverters to be used by the underlyingRestTemplate. Converters configured via this method will override the default converters.- Parameters:
- messageConverters- The message converters.
- See Also:
 
- 
setRequestFactorySet theClientHttpRequestFactoryfor the underlyingRestTemplate.- Parameters:
- requestFactory- The request factory.
- See Also:
 
- 
setEncodingModeDescription copied from class:AbstractHttpRequestExecutingMessageHandlerSet the encoding mode to use. By default, this is set toDefaultUriBuilderFactory.EncodingMode.TEMPLATE_AND_VALUES. For more complicated scenarios consider configuring anUriTemplateHandleron an externally providedRestTemplate.- Overrides:
- setEncodingModein class- AbstractHttpRequestExecutingMessageHandler
- Parameters:
- encodingMode- the mode to use for uri encoding
 
- 
exchange@Nullable protected Object exchange(Object uri, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage, Map<String, ?> uriVariables) - Specified by:
- exchangein class- AbstractHttpRequestExecutingMessageHandler
 
 
-