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?
Simon OUALID - 23 Jul 2005 15:54 GMT
Why not choosing to use the Jakarta/Apache Commons Net libraries ? It
works very well.
http://jakarta.apache.org/commons/net/
> Is the URLConnection class capable of being subclassed to create custom
> protocol connections? Protocol in this case refers to ANY and ALL
[quoted text clipped - 3 lines]
> If yes, should i use it or connect using the old fashion way of using
> io/nio?
Raymond DeCampo - 23 Jul 2005 18:38 GMT
> Is the URLConnection class capable of being subclassed to create custom
> protocol connections? Protocol in this case refers to ANY and ALL
[quoted text clipped - 3 lines]
> 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

Signature
XML is the programmer's duct tape.
Thomas Fritsch - 24 Jul 2005 19:38 GMT
> 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?

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