java - https ://pubsubhubbub. appspot.com/subscribe 空响应

标签 java websub

我有一个连接到 https://pubsubhubbub.appspot.com/subscribe 的订阅者客户端我把参数放在下面

https://pubsubhubbub.appspot.com/subscribe
hub.topic    http://...../lastupby
hub.callback http://localhost:8080/Subscription/subscription/subscribe
hub.mode subscribe

但我得到了空响应,我不明白问题是什么,谢谢您的帮助

HttpPost httppost = new HttpPost(hub);  
                List<NameValuePair> nvps = new ArrayList<NameValuePair>();
                nvps.add(new BasicNameValuePair("hub.callback", callbackUrl));
                nvps.add(new BasicNameValuePair("hub.mode", "subscribe"));
                nvps.add(new BasicNameValuePair("hub.topic", topic_url));
                nvps.add(new BasicNameValuePair("hub.verify", "sync"));
                if (lease_seconds != null)
                    nvps.add(new BasicNameValuePair("hub.lease_seconds", lease_seconds));
                //For future https implementation
                //if ((secret !=null) && (secret.getBytes("utf8").length < 200))
                //  nvps.add(new BasicNameValuePair("hub.hub.secret", secret));
                if (verifytoken !=null)
                    nvps.add(new BasicNameValuePair("hub.verify_token", verifytoken));

                webserver.addAction("subscribe",topic_url, verifytoken);

                httppost.setEntity(new UrlEncodedFormEntity(nvps));
                httppost.setHeader("Content-type", "application/x-www-form-urlencoded");
                httppost.setHeader("User-agent", "RSS pubsubhubbub 0.3");

                //create the thread and start it running
                GetThread thread = new GetThread(httpClient, httppost);
                thread.start();
                thread.join();

谢谢

最佳答案

您应该检查的第一件事是响应的 HTTP 状态,然后检查正文本身,因为可能包括您做错了什么。

此外,根据您的示例,我几乎可以肯定问题出在您的回调网址上。当您向中心发送订阅请求时,中心需要与您确认您是否需要此订阅。然后,它向您的回调 URL 发送请求(检查规范中的意图验证部分)。由于您的回调确实位于防火墙后面,因此集线器将永远无法到达它。

关于java - https ://pubsubhubbub. appspot.com/subscribe 空响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8571761/

相关文章:

java - 我刚刚安装了 android SDK 更新,现在我的项目充满了错误

java - Swing 流布局中断元素

javascript - 实时更新显示,如 friend 提要或推特热门推文

Heroku:当我的 Redis 连接都被使用时会发生什么?

publish-subscribe - PubSubHubbub 中 hub.lease_seconds 的最大值

java - 具有水平滚动的嵌套 RecyclerView

java.lang.ClassCastException : List cannot be cast to java. lang.Comparable

java - H2索引名称唯一性

ruby - 如何订阅 PubSubHubbub github?

ios - Apache Kafka - iOS 消费者