Java:如何停止或避免特殊字符的URL编码?

时间:2019-05-01 19:57:49

标签: java urlencode

silverpop“ REST” API需要使用管道符号:“ |”在网址中。例如:

https://api6.ibmmarketingcloud.com/rest/databases/xxx/establishidentity/PUSH-xxx/xxxx|yyyy

使用我们的代码时,它将代替|与“%7C”

这是代码:

String url = baseURL + key + "/" + id + "|" + channel;
WebTarget webTarget = theHttpClient.target(url);
Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON)
                .header(HttpUtils.AUTHORISATION_HEADER_NAME, "Bearer " + theAccessToken);
response = invocationBuilder.method(method.getName(), Entity.json(theObjectMapper.writeValueAsString(payload)), response.class);

是否有方便的方法来停止|的转换?进入%7C?

0 个答案:

没有答案