Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
- - 23 Jul 2005 13:09 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....

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('$','@')



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.