Thread View: comp.lang.java.help
4 messages
4 total messages
Started by Guillermo Tempo
Thu, 23 Jul 1998 00:00
HttpUrlConnection
Author: Guillermo Tempo
Date: Thu, 23 Jul 1998 00:00
Date: Thu, 23 Jul 1998 00:00
30 lines
1573 bytes
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
Re: HttpUrlConnection
Author: Tristan Austin
Date: Fri, 24 Jul 1998 00:00
Date: Fri, 24 Jul 1998 00:00
67 lines
2235 bytes
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
*****************************************
Re: HttpUrlConnection
Author: cameron_cp
Date: Fri, 24 Jul 1998 00:00
Date: Fri, 24 Jul 1998 00:00
24 lines
1587 bytes
1587 bytes
In article <6p87ki$7fd$1@supernews.com>, "Guillermo Tempo" <Guillermo_Tempo@oti.com> wrote: > I think I understand why I get the exception. Is there a way around this > without having to implement HttpURLConnection and/or the StreamHandler. ==public abstract class HttpURLConnection extends URLConnection You are correct, You will have to define public abstract void disconnect() Close the connection to the server. public abstract boolean usingProxy() Indicates if the connection is going through a proxy. -- The Idiot's Guide To Everything (ComputerRelated) http://members.tripod.com/~igte ================================================= -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Re: HttpUrlConnection
Author: Guillermo Tempo
Date: Fri, 24 Jul 1998 00:00
Date: Fri, 24 Jul 1998 00:00
29 lines
1855 bytes
1855 bytes
Well, I'll have to face the inevitable... Thanks a lot for the reply. cameron_cp@my-dejanews.com wrote in message <6p98is$mcd$1@nnrp1.dejanews.com>... >In article <6p87ki$7fd$1@supernews.com>, > "Guillermo Tempo" <Guillermo_Tempo@oti.com> wrote: >> I think I understand why I get the exception. Is there a way around this >> without having to implement HttpURLConnection and/or the StreamHandler. > >==public abstract class HttpURLConnection extends URLConnection > >You are correct, You will have to define > > public abstract void disconnect() > Close the connection to the server. > > public abstract boolean usingProxy() > Indicates if the connection is going through a proxy. > > > >-- >The Idiot's Guide To Everything (ComputerRelated) >http://members.tripod.com/~igte >================================================= > >-----== Posted via Deja News, The Leader in Internet Discussion ==----- >http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads