001 /*
002 *
003 * $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
004 *
005 * This file is part of *** M y C o R e ***
006 * See http://www.mycore.de/ for details.
007 *
008 * This program is free software; you can use it, redistribute it
009 * and / or modify it under the terms of the GNU General Public License
010 * (GPL) as published by the Free Software Foundation; either version 2
011 * of the License or (at your option) any later version.
012 *
013 * This program is distributed in the hope that it will be useful, but
014 * WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program, in a file called gpl.txt or license.txt.
020 * If not, write to the Free Software Foundation Inc.,
021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
022 */
023
024 package org.mycore.frontend.wcms;
025
026 import java.io.IOException;
027 import java.util.ArrayList;
028
029 import javax.servlet.ServletException;
030 import javax.servlet.http.HttpServletRequest;
031 import javax.servlet.http.HttpServletResponse;
032
033 import org.jdom.Document;
034 import org.jdom.Element;
035 import org.mycore.common.MCRSession;
036 import org.mycore.common.MCRSessionMgr;
037
038 public class MCRWCMSLoginServlet extends MCRWCMSServlet {
039 private static final long serialVersionUID = 1L;
040
041 protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
042 // init
043 MCRSession session = MCRSessionMgr.getCurrentSession();
044 String userID = session.getCurrentUserID();
045 String userRealName = session.getCurrentUserID();
046 String userClass = "admin";
047 // fill session
048 session.put("status", "loggedIn");
049 session.put("userID", userID);
050 session.put("userRealName", userRealName);
051 session.put("userClass", userClass);
052 session.put("rootNodes", new ArrayList());
053 // build jdom
054 Element root = new Element("cms");
055 Document jdom = new Document(root);
056 root.addContent(new Element("session").setText("welcome"));
057 root.addContent(new Element("userID").setText(userID));
058 root.addContent(new Element("userRealName").setText(userRealName));
059 root.addContent(new Element("userClass").setText(userClass));
060 root.addContent(new Element("error").setText(""));
061 root.addContent(new Element("rootNode").setAttribute("href", "href value").setText("root node..."));
062 root.addContent(new Element("modus").setText("true"));
063 // do layout
064 getLayoutService().doLayout(request, response, jdom);
065 }
066 }