Results 1 to 3 of 3
  1. #1
    madsac is offline Member
    Join Date
    Oct 2014
    Posts
    2
    Rep Power
    0

    Default Custom JavaFX WebView Protocol Handler

    Hello,
    I asked same question in stackoverflow but i didnt get good response nether solution.

    I want to intercept all http request ( via ajax,form post) from my webengine or webview. Just as we can see all loaded & loading elements in chrome ( developer console > network)

    I checked documentation WebEngine (JavaFX 2.2) WebEngine (JavaFX 8) but cannot find any method which does the same.


    Here is progress what i did so far.It can open a page simple http but cannot load css


    Java FX Code:
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.URLStreamHandler;
    
    public class MyURLHandler extends URLStreamHandler
    {
    
        @Override
        protected URLConnection openConnection(URL url) throws IOException
        {
            System.out.println("Requested:" + url.getPath());
    
            return new URLConnection(url) {
                HttpURLConnection connection;
                @Override
                public void connect() throws IOException {
                    connection = (HttpURLConnection) url.openConnection();
                    connection.setDoInput(true);
                    connection.connect();
                }
    
                public InputStream getInputStream() throws IOException {
                   return connection.getInputStream();
                }
            };
        }
    
    }
    Java FX Code:
    import java.net.URLStreamHandler;
    import java.net.URLStreamHandlerFactory;
    
    public class MyURLStreamHandlerFactory implements URLStreamHandlerFactory
    {
    
        public URLStreamHandler createURLStreamHandler(String protocol)
        {
            System.out.println(protocol);
            if (protocol.equals("http"))
            {
                return new MyURLHandler();
            }
            return null;
        }
    
    }
    Java FX Code:
    URL.setURLStreamHandlerFactory(new MyURLStreamHandlerFactory());

    When i tried to open Java (programming language) - Wikipedia, the free encyclopedia only text loaded.
    Java FX Code:
    Connected to the target VM, address: '127.0.0.1:58096', transport: 'socket'
    file
    http
    Requested:/en.wikipedia.org/load.php
    Requested:/en.wikipedia.org/load.php
    Requested:/en.wikipedia.org/load.php
    Requested:/en.wikipedia.org/load.php
    Requested:/en.wikipedia.org/load.php
    Requested:/en.wikipedia.org/load.php
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/2/28/Padlock-silver-light.svg/20px-Padlock-silver-light.svg.png
    Requested:/wikipedia/commons/thumb/2/28/Padlock-silver-light.svg/20px-Padlock-silver-light.svg.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/16px-Wikibooks-logo-en-noslogan.svg.png
    Requested:/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/16px-Wikibooks-logo-en-noslogan.svg.png
    Requested:/wikipedia/commons/thumb/a/a4/Java_logo_and_wordmark.svg/100px-Java_logo_and_wordmark.svg.png
    Requested:/wikipedia/commons/thumb/a/a4/Java_logo_and_wordmark.svg/100px-Java_logo_and_wordmark.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/170px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/170px-Wave.svg.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/1/14/James_Gosling_2008.jpg/220px-James_Gosling_2008.jpg
    Requested:/wikipedia/commons/thumb/1/14/James_Gosling_2008.jpg/220px-James_Gosling_2008.jpg
    Requested:/static-1.25wmf1/extensions/FlaggedRevs/frontend/modules/img/doc-magnify.png
    Requested:/static-1.25wmf1/extensions/FlaggedRevs/frontend/modules/img/doc-magnify.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/static-1.25wmf1/extensions/FlaggedRevs/frontend/modules/img/arrow-down.png
    Requested:/static-1.25wmf1/extensions/FlaggedRevs/frontend/modules/img/arrow-down.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/images/wikimedia-button.png
    Requested:/images/wikimedia-button.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/static-1.25wmf1/resources/assets/poweredby_mediawiki_88x31.png
    Requested:/static-1.25wmf1/resources/assets/poweredby_mediawiki_88x31.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/en/f/f4/Ambox_content.png
    Requested:/wikipedia/en/f/f4/Ambox_content.png
    Requested:/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png
    Requested:/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/c/c7/Android_4.4.2.png/170px-Android_4.4.2.png
    Requested:/wikipedia/commons/thumb/c/c7/Android_4.4.2.png/170px-Android_4.4.2.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/60px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/60px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/15px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/15px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/1/1d/8bit-dynamiclist.gif/28px-8bit-dynamiclist.gif
    Requested:/wikipedia/commons/thumb/1/1d/8bit-dynamiclist.gif/28px-8bit-dynamiclist.gif
    Requested:/wikipedia/commons/thumb/f/f8/Wiktionary-logo-en.svg/23px-Wiktionary-logo-en.svg.png
    Requested:/wikipedia/commons/thumb/f/f8/Wiktionary-logo-en.svg/23px-Wiktionary-logo-en.svg.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/a/a8/Office-book.svg/30px-Office-book.svg.png
    Requested:/wikipedia/commons/thumb/a/a8/Office-book.svg/30px-Office-book.svg.png
    Oct 03, 2014 5:22:01 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/en/thumb/4/4a/Commons-logo.svg/18px-Commons-logo.svg.png
    Requested:/wikipedia/en/thumb/4/4a/Commons-logo.svg/18px-Commons-logo.svg.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/f/fa/Wikiquote-logo.svg/21px-Wikiquote-logo.svg.png
    Requested:/wikipedia/commons/thumb/f/fa/Wikiquote-logo.svg/21px-Wikiquote-logo.svg.png
    Requested:/wikipedia/commons/thumb/f/fa/Wikibooks-logo.svg/25px-Wikibooks-logo.svg.png
    Requested:/wikipedia/commons/thumb/f/fa/Wikibooks-logo.svg/25px-Wikibooks-logo.svg.png
    Requested:/wikipedia/commons/thumb/1/1b/Wikiversity-logo-en.svg/25px-Wikiversity-logo-en.svg.png
    Requested:/wikipedia/commons/thumb/1/1b/Wikiversity-logo-en.svg/25px-Wikiversity-logo-en.svg.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/9/91/Wikiversity-logo.svg/40px-Wikiversity-logo.svg.png
    Requested:/wikipedia/commons/thumb/9/91/Wikiversity-logo.svg/40px-Wikiversity-logo.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/75px-Wave.svg.png
    Requested:/wikipedia/commons/thumb/4/40/Wave.svg/75px-Wave.svg.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/commons/thumb/8/89/Symbol_book_class2.svg/16px-Symbol_book_class2.svg.png
    Requested:/wikipedia/commons/thumb/8/89/Symbol_book_class2.svg/16px-Symbol_book_class2.svg.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/en/thumb/4/48/Folder_Hexagonal_Icon.svg/16px-Folder_Hexagonal_Icon.svg.png
    Requested:/wikipedia/en/thumb/4/48/Folder_Hexagonal_Icon.svg/16px-Folder_Hexagonal_Icon.svg.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png
    Requested:/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png
    Requested:/wikipedia/en/thumb/f/fd/Portal-puzzle.svg/16px-Portal-puzzle.svg.png
    Requested:/wikipedia/en/thumb/f/fd/Portal-puzzle.svg/16px-Portal-puzzle.svg.png
    Requested:/wikipedia/en/b/bc/Wiki.png
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Oct 03, 2014 5:22:02 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.NullPointerException
    	at myPackage.MyURLHandler$1.getInputStream(MyURLHandler.java:28)
    	at com.sun.webkit.network.URLLoader.close(URLLoader.java:572)
    	at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:172)
    	at com.sun.webkit.network.URLLoader.lambda$run$87(URLLoader.java:127)
    	at com.sun.webkit.network.URLLoader$$Lambda$112/808170155.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.sun.webkit.network.URLLoader.run(URLLoader.java:126)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    Requested:/wikipedia/en/b/bc/Wiki.png

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Custom JavaFX WebView Protocol Handler

    Java FX Code:
    return new URLConnection(url) { // <--- why ??
    Why are you returning an anonymous URLConnection instance which wraps around a HttpURLConnection? Just use url.openConnection() and that HttpURLConnection directly.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    madsac is offline Member
    Join Date
    Oct 2014
    Posts
    2
    Rep Power
    0

    Default Re: Custom JavaFX WebView Protocol Handler

    as you can see functions returns URLConnection . what should i return ?

    If i return null, null pointer exception occurs.

    May be my thought are different from yours. So if you think i am wrong. Please post the code.

Similar Threads

  1. JavaFX Book | Learn JavaFX More In Depth
    By SnakeDoc in forum JavaFX
    Replies: 0
    Last Post: 05-17-2013, 11:10 PM
  2. Adding tabs in webview
    By saif in forum Android
    Replies: 0
    Last Post: 03-17-2013, 08:59 AM
  3. JavaFX WebView Initialization
    By phyzix5761 in forum JavaFX
    Replies: 1
    Last Post: 12-19-2012, 02:51 AM
  4. Clear webview cache?
    By appz in forum Android
    Replies: 0
    Last Post: 10-29-2012, 10:14 PM
  5. JavaFX Script and JavaFX Mobile
    By levent in forum Java Software
    Replies: 1
    Last Post: 01-27-2010, 04:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •