Javafx webview http response data


Question

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

1
1
6/13/2013 7:02:33 PM

Accepted Answer

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.

Some of the concepts are explained in A New Era for Java Protocol Handlers whitepaper.

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.

5
6/13/2013 9:04:59 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon