Receive a blank notification on a production server

I am developing an application for Google Glass using the api mirror. during development, I used Introspective Tunnels for the Local Host to get notified.

Now I uploaded my application to the production server. So now I configure my callback URL as my domain name, for example https://www.mydomain.com:8443/notify . But I get a blank notification.

in the servlet notification:

BufferedReader notificationReader = new BufferedReader(
        new InputStreamReader(request.getInputStream()));
String notificationString = ""; 
int lines = 0;

while (notificationReader.ready()) {
    notificationString += notificationReader.readLine();
    lines++;

    if (lines > 1000) {
        throw new IOException(
                "Attempted to parse notification payload that was unexpectedly long.");
    }
}

LOG.info("\ngot raw notification : " + notificationString);

in catalina.out

Feb 13, 2014 12:51:48 PM com.google.glassware.NotifyServlet doPost
INFO: got raw notification : 

How can i solve this?

+3
source share
4 answers
StringBuffer stringBuffer = new StringBuffer();
                String line = "";
                BufferedReader bufferReader = new BufferedReader(
                                       new InputStreamReader(request.getInputStream()));
                while ((line = bufferReader.readLine()) != null) {         
                    stringBuffer.append(line);
                }
                notificationString = stringBuffer.toString();

Hope this works.

+1
source

, readLine(). ready() .

, . , . , , , , , , .

, end , , , , . ready() , .

0

, , :

 StringBuffer jb = new StringBuffer();
 String notificationString = "";
 String line = "";
 BufferedReader reader = request.getReader();
 while ((line = reader.readLine()) != null) {         
     jb.append(line);
 }
 notificationString = jb.toString();
0
source

Try the following:

while(notificationReader.ready()) {
    notificationString = notificationString.concat(notificationReader.readLine());
    lines++;
}
0
source

All Articles