classpath-inetlib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpath-inetlib] Use of NNTPConnection


From: Chris Burdess
Subject: Re: [Classpath-inetlib] Use of NNTPConnection
Date: Tue, 29 Aug 2006 08:34:24 +0100

Carsten Ringe wrote:
I want to build this function into my NNTP newsreader and I can't find it in the API. Could someone please help me with this or confirm that it isn't possible?
Sure, see gnu.inet.nntp.NNTPConnection.article(String)

Thanks for this hint. I read the javadoc for this class, and it really does what I need. But unfortunatly I don't know how to get this. I create the NNTP connection this way (it may be not 100% exact, but I can't look at the sources at the moment...):

Session session = Session.getDefaultInstance(properties, null);
Store store = session.getStore();
Folder folder = store.getDefaultFolder();

Now my problem is: How do I get a NNTPConnection object at some point in this procedure? Or should I just create a new object when I want to request an article by its message ID? Just creating a NNTPConnection with my login data, retrieving the article and then destroy that NNTPConnection?

There are two different things here. You're talking about using the JavaMail API to get the article. There isn't an API function to do this (by message-id) in JavaMail (I expect you could use the search() method but this isn't implemented specially for NNTP anyway so it would be very inefficient).

But you can use the lower-level inetlib API to do it. If you're building a serious newsreader you'll want more control in any case (like how to handle newsrcs) and the MIME framework JavaMail provides is unlikely to be relevant. So just ignore JavaMail and manage a pool of NNTPConnections directly.
--
犬 Chris Burdess
  "They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety." - Benjamin Franklin




Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]