diff options
-rw-r--r-- | src/main/java/com/juick/PushComponent.java | 10 |
1 files changed, 3 insertions, 7 deletions
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(); |