用JAVA访问Domino资源,实现Domino邮件的RSS

源代码(草草的写的,请多包涵):

 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://l92.168.1.7/mail/r.nsf");
        channel.setTitle("Domino Mail");
        channel.setImage("http://l92.168.1.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();
 }
 
}
}

原文地址:https://www.cnblogs.com/hannover/p/1899768.html