-
Bug
-
Resolution: Fixed
-
P4
-
None
-
fx2.0, 7-pool
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.
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.