小编Ani*_*Das的帖子

如何在 Spring RestTemplate 中禁用 URL 编码?

String url = serverUrl + metadata.getUri();
response = restTemplate.exchange(url, metadata.getAction(), requestEntity, metadata.getResponseType());
Run Code Online (Sandbox Code Playgroud)

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 url-encoding resttemplate

1
推荐指数
1
解决办法
4479
查看次数

标签 统计

resttemplate ×1

spring ×1

url-encoding ×1