From ee01596d0cae3683bf6cdb4eb0184f68d0b44b49 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 29 Dec 2015 01:46:36 +0300 Subject: push: fix sendWNS, take 2 --- src/main/java/com/juick/PushComponent.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/PushComponent.java b/src/main/java/com/juick/PushComponent.java index 7b6c90ec..0f806827 100644 --- a/src/main/java/com/juick/PushComponent.java +++ b/src/main/java/com/juick/PushComponent.java @@ -266,21 +266,17 @@ public class PushComponent implements ServletContextListener, Stream.StreamListe boolean ret = false; try { HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); - conn.setDoInput(true); - conn.setDoOutput(true); - OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); - conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); - Integer contentLength = xml.getBytes(wr.getEncoding()).length; - conn.setRequestProperty("Content-Length", contentLength.toString()); String token = "Bearer " + wns_client_secret; conn.setRequestProperty("Authorization", token); conn.setRequestProperty("X-WNS-Type", "wns/toast"); // todo: mb use "wns/badge" or "wns/tile" - conn.setUseCaches(false); + conn.setDoInput(true); + conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.connect(); + OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(xml); wr.close(); -- cgit v1.2.3