【发布时间】:2017-11-21 20:50:17
【问题描述】:
String url = serverUrl + metadata.getUri();
response = restTemplate.exchange(url, metadata.getAction(), requestEntity, metadata.getResponseType());
url 包含字符串
https://localhost/api/fm/info/dump/a\b\f\20170722_225714.jpg?lastModified=1507881481909
Spring RestTemplate 在向服务器请求时将其编码为以下内容
https://localhost/api/fm/info/dump/a%5Cb%5Cf%5C20170722_225714.jpg?lastModified=1507881481909
仅供参考,我需要禁用 URL 编码,以便“\”字符在服务器端可用,因为这是业务需求,因为我们的 Web 服务器 (Nginx) 已配置为根据请求的路径执行一些检查包含'\'字符。
【问题讨论】:
标签: spring resttemplate url-encoding