|
|
|
@ -35,7 +35,6 @@ import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory; |
|
|
|
import org.springframework.http.client.Netty4ClientHttpRequestFactory; |
|
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
import org.springframework.util.concurrent.ListenableFuture; |
|
|
|
import org.springframework.util.concurrent.ListenableFutureCallback; |
|
|
|
import org.springframework.web.client.AsyncRestTemplate; |
|
|
|
@ -49,6 +48,7 @@ import org.thingsboard.rule.engine.api.util.TbNodeUtils; |
|
|
|
import org.thingsboard.rule.engine.credentials.BasicCredentials; |
|
|
|
import org.thingsboard.rule.engine.credentials.ClientCredentials; |
|
|
|
import org.thingsboard.rule.engine.credentials.CredentialsType; |
|
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
import org.thingsboard.server.common.msg.TbMsg; |
|
|
|
import org.thingsboard.server.common.msg.TbMsgMetaData; |
|
|
|
|
|
|
|
@ -192,7 +192,7 @@ public class TbHttpClient { |
|
|
|
config.isIgnoreRequestBody()) { |
|
|
|
entity = new HttpEntity<>(headers); |
|
|
|
} else { |
|
|
|
entity = new HttpEntity<>(msg.getData(), headers); |
|
|
|
entity = new HttpEntity<>(getData(msg), headers); |
|
|
|
} |
|
|
|
|
|
|
|
URI uri = buildEncodedUri(endpointUrl); |
|
|
|
@ -243,6 +243,18 @@ public class TbHttpClient { |
|
|
|
return uri; |
|
|
|
} |
|
|
|
|
|
|
|
private String getData(TbMsg msg) { |
|
|
|
String data = msg.getData(); |
|
|
|
|
|
|
|
if (config.isTrimDoubleQuotes()) { |
|
|
|
final String dataBefore = data; |
|
|
|
data = data.replaceAll("^\"|\"$", "");; |
|
|
|
log.trace("Trimming double quotes. Before trim: [{}], after trim: [{}]", dataBefore, data); |
|
|
|
} |
|
|
|
|
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
private TbMsg processResponse(TbContext ctx, TbMsg origMsg, ResponseEntity<String> response) { |
|
|
|
TbMsgMetaData metaData = origMsg.getMetaData(); |
|
|
|
metaData.putValue(STATUS, response.getStatusCode().name()); |
|
|
|
|