如何获取 https、分块 Push Servlet 的 InputStream?
我花了三天时间来了解如何连接到 https 分块推送 servlet 并获取输入流。 与 HttpsURLConnection
的连接有效,也与 HttpClient
有效 但是在每个编程代码中,当我尝试获取该servlet的InputStream时,这一行会阻塞!没有错误,没有异常,什么都没有。调试器仅在此行停止并等待。
我知道 servlet 的标头中没有 Content-Length
并且我知道这就是 URLConnection
的方法 getInputStream
的原因块。
但现在我没有其他想法。有谁可以帮助我从 servlet 获取这个 InputStream
吗?所有连接都可以使用 HttpsURLConnection
和 HTTPClient
仅获取 InputStream 失败,我不知道为什么。
I spend three days in find out how I can connect to an https chunked push servlet and get an inputstream.
The connection with HttpsURLConnection
works and also with HttpClient
but in every programmed code, when I try to get the InputStream of this servlet, this line blocks! No error, no exception, nothing. The debugger only stops at this line and wait.
I know that there is no Content-Length
in the Header of the servlet and I know that this was the reason why the method getInputStream
of URLConnection
blocks.
But now I have no other Idea. Is there anyone who can help me to get this InputStream
from the servlet? All connections are fine with HttpsURLConnection
and HTTPClient
only getting the InputStream Fails and I don't know why.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题解决了!史诗般的失败:在我连接到 servlet 以获得响应之前,我必须连接到另一个 servlet 来启动会话,而不是保存 cookie 并继续。我使用了 HttpsURLConnection,它运行得很好... Fazit:流媒体在 Android 上运行良好
The problem is solved! Epic Fail: befor i connect to the servlet to get the response i have to connect to another servlet to start the session, than save the cookie and go on. i Used HttpsURLConnection and it works quiet good... Fazit: Streaming works well on Android