public abstract class AbstractHttpRequestExecutingMessageHandler extends AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandlerIntegrationManagement.ManagementOverridesmessagingTemplateEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
AbstractHttpRequestExecutingMessageHandler(Expression uriExpression) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doInit() |
protected Object |
evaluateTypeFromExpression(Message<?> requestMessage,
Expression expression,
String property) |
protected abstract Object |
exchange(java.util.function.Supplier<URI> uriSupplier,
HttpMethod httpMethod,
HttpEntity<?> httpRequest,
Object expectedResponseType,
Message<?> requestMessage) |
protected Object |
getReply(ResponseEntity<?> httpResponse) |
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
boolean |
isExpectReply() |
protected HttpHeaders |
mapHeaders(Message<?> message) |
void |
setCharset(String charset)
Specify the charset name to use for converting String-typed payloads to bytes.
|
void |
setEncodeUri(boolean encodeUri)
Specify whether the real URI should be encoded after
uriVariables
expanding and before send request via
RestTemplate. |
void |
setExpectedResponseType(Class<?> expectedResponseType)
Specify the expected response type for the REST request
otherwise the default response type is
ResponseEntity and will
be returned as a payload of the reply Message. |
void |
setExpectedResponseTypeExpression(Expression expectedResponseTypeExpression)
Specify the
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. |
void |
setExpectReply(boolean expectReply)
Specify whether a reply Message is expected.
|
void |
setExtractPayload(boolean extractPayload)
Specify whether the outbound message's payload should be extracted
when preparing the request body.
|
void |
setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
Set the
HeaderMapper to use when mapping between HTTP headers and MessageHeaders. |
void |
setHttpMethod(HttpMethod httpMethod)
Specify the
HttpMethod for requests. |
void |
setHttpMethodExpression(Expression httpMethodExpression)
Specify the SpEL
Expression to determine HttpMethod at runtime. |
void |
setTransferCookies(boolean transferCookies)
Set to true if you wish 'Set-Cookie' headers in responses to be
transferred as 'Cookie' headers in subsequent interactions for
a message.
|
void |
setTrustedSpel(boolean trustedSpel)
Set to true if you trust the source of SpEL expressions used to evaluate URI
variables.
|
void |
setUriVariableExpressions(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.
|
void |
setUriVariablesExpression(Expression uriVariablesExpression)
Set the
Expression to evaluate against the outbound message; the expression
must evaluate to a Map of URI variable expressions to evaluate against the outbound message
when replacing the variable placeholders in a URI template. |
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyaddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersconfigureMetrics, destroy, getActiveCount, getActiveCountLong, getComponentType, getDuration, getErrorCount, getErrorCountLong, getHandleCount, getHandleCountLong, getManagedName, getManagedType, getMaxDuration, getMeanDuration, getMetricsCaptor, getMinDuration, getOrder, getOverrides, getStandardDeviationDuration, handleMessage, isCountsEnabled, isLoggingEnabled, isStatsEnabled, onComplete, onError, onNext, onSubscribe, registerMetricsCaptor, reset, setCountsEnabled, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, setStatsEnabledafterPropertiesSet, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiterrorCount, handleCountgetBeanName, getComponentNamepublic AbstractHttpRequestExecutingMessageHandler(Expression uriExpression)
public void setEncodeUri(boolean encodeUri)
uriVariables
expanding and before send request via
RestTemplate. The default value is
true.encodeUri - true if the URI should be encoded.UriComponentsBuilderpublic void setHttpMethodExpression(Expression httpMethodExpression)
Expression to determine HttpMethod at runtime.httpMethodExpression - The method expression.public void setHttpMethod(HttpMethod httpMethod)
HttpMethod for requests.
The default method is POST.httpMethod - The method.public void setExtractPayload(boolean extractPayload)
true.extractPayload - true if the payload should be extracted.public void setCharset(String charset)
UTF-8.charset - The charset.public boolean isExpectReply()
setExpectReply(boolean)public void setExpectReply(boolean expectReply)
expectReply - true if a reply is expected.public void setExpectedResponseType(Class<?> expectedResponseType)
ResponseEntity and will
be returned as a payload of the reply Message.
To take advantage of the HttpMessageConverters
registered on this adapter, provide a different type).expectedResponseType - The expected type.
Also see setExpectedResponseTypeExpression(Expression)public void setExpectedResponseTypeExpression(Expression expectedResponseTypeExpression)
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.expectedResponseTypeExpression - The expected response type expression.
Also see setExpectedResponseType(java.lang.Class<?>)public void setHeaderMapper(HeaderMapper<HttpHeaders> headerMapper)
HeaderMapper to use when mapping between HTTP headers and MessageHeaders.headerMapper - The header mapper.public void setUriVariableExpressions(Map<String,Expression> uriVariableExpressions)
uriVariableExpressions - The URI variable expressions.public void setUriVariablesExpression(Expression uriVariablesExpression)
Expression to evaluate against the outbound message; the expression
must evaluate to a Map of URI variable expressions to evaluate against the outbound message
when replacing the variable placeholders in a URI template.uriVariablesExpression - The URI variables expression.public void setTransferCookies(boolean transferCookies)
transferCookies - the transferCookies to set.public void setTrustedSpel(boolean trustedSpel)
SimpleEvaluationContext is used
for evaluating such expressions, which restricts the use of some SpEL capabilities.trustedSpel - true to trust.protected void doInit()
doInit in class AbstractReplyProducingMessageHandlerprotected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandlerhandleRequestMessage in class AbstractReplyProducingMessageHandlerrequestMessage - The request message.null.protected abstract Object exchange(java.util.function.Supplier<URI> uriSupplier, HttpMethod httpMethod, HttpEntity<?> httpRequest, Object expectedResponseType, Message<?> requestMessage)
protected Object getReply(ResponseEntity<?> httpResponse)
protected HttpHeaders mapHeaders(Message<?> message)