Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8114548

WebView: Internal handling of specific protocols?

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: fx2.0, 7-pool
    • Fix Version/s: None
    • Component/s: javafx
    • Subcomponent:
      web

      Description

      We are using a custom UrlStreamHandlerFactory to be able to intercept links and react to specific protocols, but not all protocols run into this method.

      public class GuiUrlStreamHandlerFactory implements URLStreamHandlerFactory {

      @Override
      public URLStreamHandler createURLStreamHandler(String protocol) {
      /*
      * FILES dont run into this method (e.g. .svg, .doc, .pdf)
      *
      * There seems to be some internal handling of the file handler (TODO: WHY??)
      */

      System.out.println("FACTORY --> Found protocol: " + protocol + "!");
      if(protocol.equalsIgnoreCase("sapr3") || protocol.equalsIgnoreCase("saphtml") || protocol.equalsIgnoreCase("saphtmlp"))
      {
      System.out.println("FACTORY --> Found known protocol (" + protocol + ") - attempting to intercept...");
      LocalHandler h = new LocalHandler();
      return h;
      }
      else if(protocol.equalsIgnoreCase("http"))
      {
      System.out.println("FACTORY --> Starting http implementation...");
      sun.net.www.protocol.http.Handler h = new sun.net.www.protocol.http.Handler();
      //LocalHttpHandler h = new LocalHttpHandler();
      return h;
      }
      else if(protocol.equalsIgnoreCase("https"))
      {
      System.out.println("FACTORY --> Starting https implementation...");
      sun.net.www.protocol.https.Handler h = new sun.net.www.protocol.https.Handler();
      return h;
      }
      else if(protocol.equalsIgnoreCase("about"))
      {
      System.out.println("FACTORY --> Starting about implementation...");
      return null;
      }
      else
      {
      System.out.println("FACTORY --> protocol unknown...");
      return null;
      }
      }

      }

      When opening a file link (e.g. "http://palita.net/w/images/3/35/Tux.svg" or "http://www.gesetze-im-internet.de/bundesrecht/bgb/gesamt.pdf") the createURLStreamHandler method is not called. Is there some internal handling of the file-protocol, which interferes here? Are there any more protocols, which are intercepted?
      When calling a normal http:// or https:// page (e.g. http://www.heise.de), everything works fine.

        Attachments

          Activity

            People

            • Assignee:
              vbaranov Vasiliy Baranov (Inactive)
              Reporter:
              mweidemanjfx Matthias Weidemann (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: