log WARN message for irrelevant extractPayload
Added a WARN log message to HttpRequestExecutingMessageHandler. The warn message will let the user know that the 'extractPayload' attribute is meaningless if the provided 'httpMethod' will not send a request body.
This commit is contained in:
committed by
Mark Fisher
parent
d9d3c14a6c
commit
bb8409f96f
@@ -83,6 +83,8 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
private volatile Class<?> expectedResponseType;
|
||||
|
||||
private volatile boolean extractPayload = true;
|
||||
|
||||
private volatile boolean extractPayloadExplicitlySet = false;
|
||||
|
||||
private volatile String charset = "UTF-8";
|
||||
|
||||
@@ -93,7 +95,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
private final StandardEvaluationContext evaluationContext;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a handler that will send requests to the provided URI.
|
||||
@@ -139,6 +141,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
*/
|
||||
public void setExtractPayload(boolean extractPayload) {
|
||||
this.extractPayload = extractPayload;
|
||||
this.extractPayloadExplicitlySet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,6 +226,12 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
if (conversionService != null) {
|
||||
this.evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService));
|
||||
}
|
||||
if (!this.shouldIncludeRequestBody() && this.extractPayloadExplicitlySet){
|
||||
if (logger.isWarnEnabled()){
|
||||
logger.warn("The 'extractPayload' attribute has no meaning in the context of this handler since the provided HTTP Method is '" +
|
||||
this.httpMethod + "', and no request body will be sent for that method.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user