Connection between javafx2.2 webengine and webscar

2019-08-30 09:11发布

Here is the deal. I want to set WebScarab as the internal proxy in my javaFX2.2 Web engine browser. I try a solution as described in here and also had a look to the links in the same page, but i get an error in the web view. here is a sample of my code:

        public WebBrowser() {

        System.setProperty("http.proxyHost", "localhost");
        System.setProperty("http.proxyPort", "8008");
        //ProxySelector.setDefault(new AlwaysProxySelector());

        WebView view;
        final WebEngine eng;    
        view = new WebView();
        view.setMinSize(10, 10);
        view.setPrefSize(500, 400);
        eng = view.getEngine();           
        eng.load("http://www.google.gr");
    }

As you can see i try also the alternative solution with class AlwaysProxySelector.

Web Scarab has a proxy that runs in localhost at port 8008 by default. First I run web scarab and then my JavaFX application. And here is the problem. The application does not throw any exception in the output screen. But in the web view, the page I want to load, never appears and a message from web scarab loads in the web view as below: enter image description here WebScarab encountered an error trying to retrieve

GET http://www.google.gr:80/ HTTP/1.1

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/535.14 (KHTML, like Gecko) JavaFX/2.2 Safari/535.14

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Cache-Control: no-cache

Pragma: no-cache

Host: www.google.gr

Proxy-Connection: keep-alive

The error was :

Connection refused: connect

at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)

at java.net.AbstractPlainSocketImpl.connect(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at org.owasp.webscarab.httpclient.URLFetcher.connect(URLFetcher.java:363)

at org.owasp.webscarab.httpclient.URLFetcher.fetchResponse(URLFetcher.java:224)

at org.owasp.webscarab.plugin.saml.SamlHTTPClient.fetchResponse(SamlHTTPClient.java:84)

at org.owasp.webscarab.plugin.proxy.CookieTracker$Plugin.fetchResponse(CookieTracker.java:130)

at org.owasp.webscarab.plugin.proxy.BrowserCache$Plugin.fetchResponse(BrowserCache.java:101)

at org.owasp.webscarab.plugin.proxy.RevealHidden$Plugin.fetchResponse(RevealHidden.java:100)

at org.owasp.webscarab.plugin.proxy.BeanShell$Plugin.fetchResponse(BeanShell.java:229)

at org.owasp.webscarab.plugin.proxy.ManualEdit$Plugin.fetchResponse(ManualEdit.java:243)

at org.owasp.webscarab.plugin.proxy.ConnectionHandler.run(ConnectionHandler.java:228)

at java.lang.Thread.run(Unknown Source)

As I can understand from the error, it seems that web scarab successfully connect to the page, but it can not retrieve the page back to the webview. The same problem occurs for every page, not only google. I do not want to use any other proxy, but only web scarab to get the advantage of using its plugins. Thanks for any idea.

1条回答
对你真心纯属浪费
2楼-- · 2019-08-30 09:34

For some reason, WebScarab is unable to reach the sites in question. This is clearly nothing to do with WebView, so we can eliminate this from the equation.

The most likely problem is that there is a proxy configured in WebScarab itself, that WebScarab cannot reach. To check this, go to Tools -> Proxies, and make sure that there is no proxy configured (unless you need an upstream proxy to reach the sites normally, in which case make sure that that is properly configured.)

查看更多
登录 后发表回答