Mail in Lotus Turn to MailRedirectServlet

xiaoxiao2021-03-06  60

It is the import java.io. *; Import javax.servlet. *; Import javax.servlet.http. *; Import lotus.domino. *;

public class MailRedirectServlet extends HttpServlet {private String server = null; private String dbname = "names.nsf"; public String getServletInfo () {return "This servlet redirects users to their own mailfile.";} public void service (HttpServletRequest request, HttpServletResponse response) throws IOException {if (request.getRemoteUser () == null) {response.setContentType ( "text / html"); PrintWriter out = response.getWriter (); out.println ( "Please create a File Protection document." } Else {notesthread.sinitthread (); try {session session = notesfactory.createsis (); Database DB = session.getDatabase (Server, DBNAME); View View = db.getView ("($ users)"); Document Doc = view.getdocumentbykey (Request.getRemoteuser (). ToolFile ()); string mailfile = ("mailfile"). Elementat (0)). Replace ('//', '/') ; If (! Mailfile.endswith (". Nsf"))) MailFile = ".nsf"; response.sendredirect (response.encoderedirecturn (Request.Getscheme () ": //" Request.gets ERVERNAME () "/" mailfile)); session.recycle ();} catch (notesException ne) {system.out.println (ne.id " ne.text);} finally {notesthread.stermthread ( );}}}} After compiling under jbuilder, put the server, start the server.

转载请注明原文地址:https://www.9cbs.com/read-112671.html

New Post(0)