diff options
author | 2017-10-23 12:46:40 +0300 | |
---|---|---|
committer | 2017-10-23 12:46:40 +0300 | |
commit | bd1af631b03569c99675970403b2047aa3a6f21c (patch) | |
tree | 4d69db34d26c0c07caa2d20a788c1def7d5e4f61 /juick-notifications/src/main | |
parent | d0d7d6ade88b23a5b2ae26502b9977d03a0a0ab8 (diff) |
notifications: prevent mpns url double-encoding
Diffstat (limited to 'juick-notifications/src/main')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/MPNSClient.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/MPNSClient.java b/juick-notifications/src/main/java/com/juick/components/MPNSClient.java index 0c136af6..646c7f93 100644 --- a/juick-notifications/src/main/java/com/juick/components/MPNSClient.java +++ b/juick-notifications/src/main/java/com/juick/components/MPNSClient.java @@ -12,6 +12,7 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.PostConstruct; import javax.inject.Inject; @@ -71,7 +72,8 @@ public class MPNSClient { httpHeaders.set("X-WNS-Type", "wns/toast"); HttpEntity<String> requestEntity = new HttpEntity<>(xml, httpHeaders); try { - wnsService.exchange(url, HttpMethod.POST, requestEntity, Void.class); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url); + wnsService.exchange(builder.build(true).toUri(), HttpMethod.POST, requestEntity, Void.class); } catch (HttpClientErrorException ex) { HttpStatus statusCode = ex.getStatusCode(); if (statusCode == HttpStatus.GONE) { |