Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.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
Java https://pubsubhubbub.appspot.com/subscribe 空响应_Java_Websub - Fatal编程技术网

Java https://pubsubhubbub.appspot.com/subscribe 空响应

Java https://pubsubhubbub.appspot.com/subscribe 空响应,java,websub,Java,Websub,我有一个订阅服务器客户端,它连接到我在下面输入的参数 https://pubsubhubbub.appspot.com/subscribe hub.topic http://...../lastupby hub.callback http://localhost:8080/Subscription/subscription/subscribe hub.mode subscribe 但是我没有得到任何回应我不明白是什么问题谢谢你的帮助 HttpPost httppost = new Htt

我有一个订阅服务器客户端,它连接到我在下面输入的参数

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();
HttpPost-HttpPost=新的HttpPost(集线器);
List nvps=new ArrayList();
添加(新的BasicNameValuePair(“hub.callback”,callbackUrl));
添加(新的BasicNameValuePair(“集线器模式”、“订阅”);
添加(新的BasicNameValuePair(“hub.topic”,topic_url));
添加(新的BasicNameValuePair(“hub.verify”、“sync”);
如果(租用秒数!=null)
添加(新的BasicNameValuePair(“hub.lease_seconds”,lease_seconds));
//用于将来的https实现
//if((secret!=null)&&(secret.getBytes(“utf8”).length<200))
//添加(新的BasicNameValuePair(“hub.hub.secret”,secret));
如果(verifytoken!=null)
添加(新的BasicNameValuePair(“集线器验证令牌”,verifytoken));
addAction(“订阅”,主题url,verifytoken);
setEntity(新的UrlEncodedFormEntity(nvps));
setHeader(“内容类型”,“应用程序/x-www-form-urlencoded”);
setHeader(“用户代理”,“RSS pubsubbub0.3”);
//创建线程并开始运行
GetThread thread=newgetthread(httpClient,httppost);
thread.start();
thread.join();

谢谢

首先要检查响应的HTTP状态,然后检查正文本身,可能包括您做错了什么


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

您遇到了什么错误/异常?当我尝试获取诸如System.out.println(“thread.httpresponse”+thread.httpresponse.getStatusLine().getReasonPhrase())之类的响应代码时,我没有收到任何错误;它返回null///我们在代理后面工作,这是造成这种情况的原因吗?我不确定我会检查,但我不确定是防火墙导致的,订阅请求后google hub会ping回调和订阅主题吗?谢谢,也许订阅url可能是错误的