Can I cast the return object from URL.openConnection() to an HttpURLConnection in an applet?

John Zukowski

Unfortunately, you can't. Both IE and NN version 4 and below return objects whose type is not HttpURLConnection or a subclass thereof.

Strictly speaking openConnection() is only guaranteed to return an object whose type is URLConnection, although for Java 1.3 the documentation implies that the type will be a HttpURLConnection.