aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-12-29 01:46:36 +0300
committerGravatar Vitaly Takmazov2015-12-29 01:46:36 +0300
commitee01596d0cae3683bf6cdb4eb0184f68d0b44b49 (patch)
treecd14b8d63387867c4c31bd9cb50d0f6b3daa5bf4 /src/main/java/com/juick
parent7688805217f71eba913a644a4d1d38a394dd7d76 (diff)
push: fix sendWNS, take 2
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/PushComponent.java10
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();