I have a library that I need to use in one of my projects, which unfortunately registers its own URLStreamHandler to handle http-URLs. Is there a w
You can register your own URLStreamHandlerFactory wirh URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
public class URLStreamHandlerFactory implements java.net.URLStreamHandlerFactory {
public URLStreamHandlerFactory() {}
public URLStreamHandler createURLStreamHandler(String protocol) {
if(protocol.equals("http")) {
return new sun.net.www.protocol.http.Handler();
} else if(protocol.equals("https")) {
return new sun.net.www.protocol.https.Handler();
}
return null;
}
}
so you can use standard handler
EDIT: Found this code