🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: HttpUrlConnection

#191
From: Tristan Austin
Date: Fri, 24 Jul 1998 00:00
67 lines
2235 bytes
Hi Guillermo

I used almost the same code and it worked fine, are you sure you've got a Http
connection there?

Guillermo Tempo wrote:


> 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
>
>





--




 Tristan Austin
 tristan.austin@dsto.defence.gov.au


*****************************************
     "One World, One Web, One Program"
     - Microsoft Promotional Ad

     "Ein Volk, Ein Reich, Ein Fuhrer"
     - Adolf Hitler

      (02) 62658828
      DSTO C3 Research Centre
      Fernhill Park
      Canberra ACT 2600
      Department of Defence
*****************************************
Technical Details
Message-ID: <35B7DD68.8215E152@dsto.defence.gov.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6p87ki$7fd$1@supernews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,f17da6d7f7577e3
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 1116f3,f17da6d7f7577e3
X-Google-Attributes: gid1116f3,public
X-Google-Thread: 10a146,f17da6d7f7577e3
X-Google-Attributes: gid10a146,public
From: Tristan Austin <tristan.austin@dsto.defence.gov.au>
Subject: Re: HttpUrlConnection
Date: 1998/07/24
Message-ID: <35B7DD68.8215E152@dsto.defence.gov.au>
X-Deja-AN: 374372100
Content-Transfer-Encoding: 7bit
References: <6p87ki$7fd$1@supernews.com>
To: Guillermo Tempo <Guillermo_Tempo@oti.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Defence Science & Technology Organisation
Mime-Version: 1.0
Newsgroups: comp.lang.java.help,comp.lang.java.programmer,es.comp.lenguajes.java