Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Is the URLConnection class capable of being subclassed to createcustom protocol connections?

Reply
Thread Tools

Is the URLConnection class capable of being subclassed to createcustom protocol connections?

 
 
-
Guest
Posts: n/a
 
      07-23-2005
Is the URLConnection class capable of being subclassed to create custom
protocol connections? Protocol in this case refers to ANY and ALL
protocol specified in RFC, e.g ftp, news, smtp, irc, nntp, and several
hundreds more or so....

If yes, should i use it or connect using the old fashion way of using
io/nio?
 
Reply With Quote
 
 
 
 
Simon OUALID
Guest
Posts: n/a
 
      07-23-2005
Why not choosing to use the Jakarta/Apache Commons Net libraries ? It
works very well.

http://jakarta.apache.org/commons/net/

- wrote:
> Is the URLConnection class capable of being subclassed to create custom
> protocol connections? Protocol in this case refers to ANY and ALL
> protocol specified in RFC, e.g ftp, news, smtp, irc, nntp, and several
> hundreds more or so....
>
> If yes, should i use it or connect using the old fashion way of using
> io/nio?

 
Reply With Quote
 
 
 
 
Raymond DeCampo
Guest
Posts: n/a
 
      07-23-2005
- wrote:
> Is the URLConnection class capable of being subclassed to create custom
> protocol connections? Protocol in this case refers to ANY and ALL
> protocol specified in RFC, e.g ftp, news, smtp, irc, nntp, and several
> hundreds more or so....
>
> If yes, should i use it or connect using the old fashion way of using
> io/nio?


I think you want a custom URLStreamHandler. See the javadoc for the URL
constructor

public URL(String protocol,
String host,
int port,
String file)
throws MalformedURLException

for configuration details.

HTH,
Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Thomas Fritsch
Guest
Posts: n/a
 
      07-24-2005
"-" <> wrote
> Is the URLConnection class capable of being subclassed to create custom
> protocol connections? Protocol in this case refers to ANY and ALL
> protocol specified in RFC, e.g ftp, news, smtp, irc, nntp, and several
> hundreds more or so....

Yes (and the built-in protocols are implemented in exactly this manner)

See <http://doc.novsu.ac.ru/oreilly/java/exp/ch09_06.htm> for a real-world
example.
(This book is still very useful, although a bit out-dated. It wrote "package
net.www.protocol" where Sun now uses "package sun.net.www.protocol")
>
> If yes, should i use it or connect using the old fashion way of using
> io/nio?


--
"TFritsch$t-online:de".replace(':','.').replace('$','@')


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OutputStream from a URLConnection produces an OutOfMemory OutputStream from a URLConnection produces an OutOfMemory WinstonSmith_101@hotmail.com Java 2 10-25-2006 04:45 PM
what are the other ways to prevent a class from being subclassed. one way is to declare the class final. srinivas.veeranki@gmail.com Java 20 02-17-2006 12:21 AM
Subclassed ClassLoader problem with array types Benji Java 1 10-06-2005 10:00 AM
Cannot view subclassed Page in Visual Designer =?Utf-8?B?U2xpbWVtYW4=?= ASP .Net 4 07-20-2005 04:03 AM
Specializing Subclassed Methods cppaddict C++ 1 06-03-2004 07:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57