Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
AGPUSH-1074: fix simple-push version payload sending
Browse files Browse the repository at this point in the history
  • Loading branch information
lfryc committed Oct 21, 2014
1 parent 37df75f commit 0e0cd75
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
*/
package org.jboss.aerogear.unifiedpush.message.sender;

import org.jboss.aerogear.unifiedpush.api.SimplePushVariant;
import org.jboss.aerogear.unifiedpush.api.Variant;
import org.jboss.aerogear.unifiedpush.message.UnifiedPushMessage;

import javax.ws.rs.core.Response.Status;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
Expand All @@ -30,6 +25,12 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.ws.rs.core.Response.Status;

import org.jboss.aerogear.unifiedpush.api.SimplePushVariant;
import org.jboss.aerogear.unifiedpush.api.Variant;
import org.jboss.aerogear.unifiedpush.message.UnifiedPushMessage;

@SenderType(SimplePushVariant.class)
public class SimplePushNotificationSender implements PushNotificationSender {

Expand Down Expand Up @@ -103,12 +104,15 @@ protected HttpURLConnection put(String url, String body) throws IOException {
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setFixedLengthStreamingMode(bytes.length);
conn.setRequestProperty("Accept", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", "" + bytes.length);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Accept", "*/*");
conn.setRequestMethod("PUT");
OutputStream out = null;
try {
out = conn.getOutputStream();
out.write(bytes);
out.flush();
} finally {
// in case something blows up, while writing
// the payload, we wanna close the stream:
Expand Down

0 comments on commit 0e0cd75

Please sign in to comment.