Source code (Please forgive me for writing rough grass ):
|
Package net. jite. jitebook. servlet;
Import java. Io. fileoutputstream;
Import java. Io. printwriter;
Import javax. servlet. http. httpservlet;
Import Lotus. Domino. database;
Import Lotus. Domino. Document;
Import Lotus. Domino. notesfactory;
Import Lotus. Domino. Session;
Import Lotus. Domino. view;
Import com. rsslibj. elements. channel;
Public class rssservlet extends httpservlet {
Public static void main (string [] ARGs) throws instantiationexception, classnotfoundexception,
Illegalaccessexception { Try { Session session = notesfactory. createsession ("127.0.0.1: 63148", "R/chengs", "7758521 "); Database mail = session. getdatabase ("", "mail \ r. nsf "); View view = Mail. getview ("($ inbox )"); Document Doc = view. getfirstdocument (); Channel channel = new channel (); Channel. setdescription ("this is my first channel ."); Channel. setlink ("http: // l93851.7/mail/R. nsf "); Channel. settitle ("Domino Mail "); Channel. setimage ("http: // l93851.7 /", "The channel image ", "Http: // localhost/foo.jpg "); While (Doc! = NULL ){ Channel. additem ("http: // 192.168.1.7/mail/" + mail. getfilename () + "/0/" + Doc. getnoteid (), Doc. getitemvaluestring ("subject"), Doc. getitemvaluestring ("body ")). setdccontributor ("ROC "); Doc = view. getnextdocument (DOC ); } Printwriter PW = new printwriter (New fileoutputstream ("e :\\ Software \ Lotus \ domino \ data \ domino \ HTML \ mail. xml ")); PW. Print (Channel. getfeed ("RSS ")); PW. Close (); } Catch (exception e ){ E. printstacktrace (); }
}
}
|