Javafx webview http响应数据 [英] Javafx webview http response data

查看:485
本文介绍了Javafx webview http响应数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从webview中加载的页面读取http请求和响应数据。我想要做的是在用户点击webview中页面内的链接后从响应中获取二进制数据。任何帮助或线索将不胜感激

Is it possible to read the http request and response data from pages loading inside webview. What i want to do is get the binary data from a response after user clicks on a link inside the page in webview. Any help or clue would be greatly appreciated

推荐答案

创建自己的 URLStreamHandlerFactory URL.setURLStreamHandlerFactory 生成 URLStreamHandler ,它包装标准的http和https URLStreamHandlers,以便在转发之前拦截其流量。

Create your own URLStreamHandlerFactory initialized by URL.setURLStreamHandlerFactory which generates a URLStreamHandler that wraps the standard http and https URLStreamHandlers to intercept their traffic before forwarding.

Java协议处理程序的新时代白皮书。

另一个选择是收听 WebEngine.location 属性并打开一个到服务器的单独连接根据需要检索和处理二进制数据。这种方法的一个例子是 pdf处理柳树网络浏览器的代码

Another option is to listen to the WebEngine.location property and open a separate connection to a server to retrieve and process the binary data as needed. An example of this approach is the pdf handling code for the willow web browser.

这篇关于Javafx webview http响应数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆