🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.help
Article #190

HttpUrlConnection

#190
From: Guillermo Tempo
Date: Thu, 23 Jul 1998 00:00
30 lines
1573 bytes
Maybe someone can help me with this, I would really apreciate it and I thank
you in advance.

Anyway, here's a piece of code that throws an exception:

import java.net.URL;
import java.net.URLConnection;
import java.net.HttpURLConnection;
...

try {
    String serverAddress = "http://..."
    URL server = new URL(serverAddress);
    HttpURLConnection connection =
(HttpURLConnection)server.openConnection();
    ...
} catch (Exception e) {
    ...
}

The exception that I get is:
java.lang.ClassCastException: com/ms/net/wininet/http/HttpURLConnection

I think I understand why I get the exception. Is there a way around this
without having to implement HttpURLConnection and/or the StreamHandler.

Hints and comments are very welcome,
thanks.

Guillermo
Technical Details
Message-ID: <6p87ki$7fd$1@supernews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,f17da6d7f7577e3,start
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 1116f3,f17da6d7f7577e3,start
X-Google-Attributes: gid1116f3,public
X-Google-Thread: 10a146,f17da6d7f7577e3,start
X-Google-Attributes: gid10a146,public
From: "Guillermo Tempo" <Guillermo_Tempo@oti.com>
Subject: HttpUrlConnection
Date: 1998/07/23
Message-ID: <6p87ki$7fd$1@supernews.com>
X-Deja-AN: 374286492
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Complaints-To: newsabuse@supernews.com
X-Trace: 901226962 /RB8GGF4O6201CC8AC usenet80.supernews.com
Organization: http://www.supernews.com, The World's Usenet: Discussions Start Here
Newsgroups: comp.lang.java.help,comp.lang.java.programmer,es.comp.lenguajes.java