Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google glass google glass通知开发和生产服务器不匹配_Google Glass_Google Mirror Api - Fatal编程技术网

Google glass google glass通知开发和生产服务器不匹配

Google glass google glass通知开发和生产服务器不匹配,google-glass,google-mirror-api,Google Glass,Google Mirror Api,我尝试使用镜像api通过应用程序中的菜单发送通知。对于开发环境,我使用代理服务器,但在生产环境中,我只使用SSl,因为它是公共域。这两个部分的回调URL如下 //发展 callbackUrl=“” 但是当我尝试从通知类读取通知时,我得到了不匹配,因此通知操作无法工作。下面是通知日志 //development got raw notification : { "collection": "timeline", "itemId": "6fa2445e-b14f-46b2-9cf

我尝试使用镜像api通过应用程序中的菜单发送通知。对于开发环境,我使用代理服务器,但在生产环境中,我只使用SSl,因为它是公共域。这两个部分的回调URL如下

//发展 callbackUrl=“”

但是当我尝试从通知类读取通知时,我得到了不匹配,因此通知操作无法工作。下面是通知日志

    //development 
    got raw notification : { "collection": "timeline", 
"itemId": "6fa2445e-b14f-46b2-9cff-f0d44d63ecab", 
"operation": "UPDATE", "verifyToken": "103560737611562800385", 
"userToken": "103560737611562800385", 
"userActions": [  {   "type": "CUSTOM",   "payload": "dealMenu"  } ]}

    //production
    got raw notification :  "collection": "timeline", 
"operation": "UPDATE", 
"userToken": "103560737611562800385",  {   "payload": "dealMenu" ]null
通知类

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

        // Count the lines as a very basic way to prevent Denial of Service
        // attacks
        int lines = 0;
        while (notificationReader.ready()) {
            notificationString += notificationReader.readLine();
            lines++;
            LOG.info("\ngot raw notification during read : "
                    + notificationString);
            // No notification would ever be this long. Something is very wrong.
            if (lines > 1000) {
                throw new IOException(
                        "Attempted to parse notification payload that was unexpectedly long.");
            }
        }

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

        JsonFactory jsonFactory = new JacksonFactory();

        LOG.info("\ngot jsonFactory : " + jsonFactory);
        // If logging the payload is not as important, use
        // jacksonFactory.fromInputStream instead.
        Notification notification = jsonFactory.fromString(notificationString,
                Notification.class);

        LOG.info("\n got notification " + notification);

在生产中,我无法得到我所需要的所有周长。为什么会发生这种不匹配

您为生产端发布的JSON看起来格式不正确。这就是你真正得到的吗?那我现在能做什么呢。因为我使用的是相同的代码。如果我在生产tomcat服务器中使用直接源代码,那么是否有可能给出正确的格式?首先,在这里确认这是生产端得到的实际JSON,而不是剪切/粘贴错误。如果是的话,有一些可能性,但我想先确定这是它。好的,听起来不错。我添加订阅执行代码。您如何捕获和显示返回的JSON?
BufferedReader notificationReader = new BufferedReader(
                new InputStreamReader(request.getInputStream()));
        String notificationString = "";

        // Count the lines as a very basic way to prevent Denial of Service
        // attacks
        int lines = 0;
        while (notificationReader.ready()) {
            notificationString += notificationReader.readLine();
            lines++;
            LOG.info("\ngot raw notification during read : "
                    + notificationString);
            // No notification would ever be this long. Something is very wrong.
            if (lines > 1000) {
                throw new IOException(
                        "Attempted to parse notification payload that was unexpectedly long.");
            }
        }

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

        JsonFactory jsonFactory = new JacksonFactory();

        LOG.info("\ngot jsonFactory : " + jsonFactory);
        // If logging the payload is not as important, use
        // jacksonFactory.fromInputStream instead.
        Notification notification = jsonFactory.fromString(notificationString,
                Notification.class);

        LOG.info("\n got notification " + notification);