X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2FMir.java;h=011b1f98efda5bd3205d37f5544ba3b3307a7963;hb=c7b5042f921185615b471a2c01ce3db157b427f9;hp=c66f9c5b66088d97a16756bb066ea6da15c3fa5c;hpb=1afc8d3728d0d841c164861bb5ac341dd2f80a1f;p=mir.git diff --git a/source/Mir.java b/source/Mir.java index c66f9c5b..011b1f98 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -1,411 +1,358 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Mir is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. - * If you do not wish to do so, delete this exception statement from your version. - */ - -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.reflect.Method; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Vector; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.UnavailableException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.struts.util.MessageResources; -import freemarker.template.SimpleHash; -import freemarker.template.SimpleList; -import freemarker.template.SimpleScalar; -import freemarker.template.TemplateModel; -import mir.config.MirPropertiesConfiguration; -import mir.entity.adapter.EntityIteratorAdapter; -import mir.generator.FreemarkerGenerator; -import mir.log.LoggerWrapper; -import mir.misc.HTMLTemplateProcessor; -import mir.misc.StringUtil; -import mir.servlet.AbstractServlet; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleDispatch; -import mir.servlet.ServletModuleExc; -import mir.servlet.ServletModuleUserExc; -import mir.util.CachingRewindableIterator; -import mir.util.ExceptionFunctions; -import mir.util.StringRoutines; -import mircoders.entity.EntityUsers; -import mircoders.global.MirGlobal; -import mircoders.module.ModuleMessage; -import mircoders.module.ModuleUsers; -import mircoders.servlet.ServletHelper; -import mircoders.servlet.ServletModuleFileEdit; -import mircoders.servlet.ServletModuleLocalizer; -import mircoders.storage.DatabaseUsers; - - - - -/** - * Mir.java - main servlet, that dispatches to servletmodules - * - * @author $Author: zapata $ - * @version $Id: Mir.java,v 1.49.2.4 2003/07/03 22:47:02 zapata Exp $ - * - */ -public class Mir extends AbstractServlet { - private static ModuleUsers usersModule = null; - private static ModuleMessage messageModule = null; - private final static Map servletModuleInstanceHash = new HashMap(); - private static Locale fallbackLocale = null; - - private static List loginLanguages = null; - - protected TemplateModel getLoginLanguages() throws ServletException { - synchronized (Mir.class) { - try { - if (loginLanguages == null) { - MessageResources messageResources = - MessageResources.getMessageResources("bundles.adminlocal"); - MessageResources messageResources2 = - MessageResources.getMessageResources("bundles.admin"); - - List languages = - StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";"); - - loginLanguages = new Vector(); - - Iterator i = languages.iterator(); - - while (i.hasNext()) { - String code = (String) i.next(); - Locale locale = new Locale(code, ""); - String name = messageResources.getMessage(locale, "languagename"); - - if (name == null) { - name = messageResources2.getMessage(locale, "languagename"); - } - - if (name == null) { - name = code; - } - - Map record = new HashMap(); - record.put("name", name); - record.put("code", code); - loginLanguages.add(record); - } - } - - return FreemarkerGenerator.makeAdapter(loginLanguages); - } - catch (Throwable t) { - throw new ServletException(t.getMessage()); - } - } - } - - public void init(ServletConfig config) throws ServletException { - super.init(config); - - usersModule = new ModuleUsers(DatabaseUsers.getInstance()); - } - - protected String getDefaultLanguage(HttpServletRequest aRequest) { - String defaultlanguage = - MirGlobal.config().getString("Mir.Login.DefaultLanguage", ""); - - if (defaultlanguage.length() == 0) { - Locale locale = aRequest.getLocale(); - defaultlanguage = locale.getLanguage(); - } - - return defaultlanguage; - } - - protected synchronized Locale getFallbackLocale() throws ServletException { - try { - if (fallbackLocale == null) { - fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), ""); - } - } - catch (Throwable t) { - throw new ServletException(t.getMessage()); - } - - return fallbackLocale; - } - - public EntityUsers checkCredentials(HttpServletRequest aRequest) throws ServletException { - try { - EntityUsers user = ServletHelper.getUser(aRequest); - - String username = aRequest.getParameter("login"); - String password = aRequest.getParameter("password"); - - if (username != null && password != null) { - user = usersModule.getUserForLogin(username, password); - - - ServletHelper.setUser(aRequest, user); - } - - return user; - } - catch (Throwable t) { - t.printStackTrace(); - - throw new ServletException(t.toString()); - } - } - - public void process(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException, IOException, UnavailableException { - try { - long startTime = System.currentTimeMillis(); - long sessionConnectTime = 0; - - HttpSession session = aRequest.getSession(true); - setNoCaching(aResponse); - Locale locale = new Locale(getDefaultLanguage(aRequest), ""); - aResponse.setContentType("text/html; charset=" + - configuration. - getString("Mir.DefaultHTMLCharset", "UTF-8")); - - EntityUsers userEntity = checkCredentials(aRequest); - - if (userEntity == null) { - String queryString = aRequest.getQueryString(); - - if ( (queryString != null) && (queryString.length() != 0) && session.getAttribute("login.target") == null && - (aRequest.getParameter("module")==null || - (!aRequest.getParameter("module").equals("login") && !aRequest.getParameter("module").equals("logout")))) { - session.setAttribute("login.target", queryString); - } - - _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); - } - else { - String moduleName = aRequest.getParameter("module"); - checkLanguage(session, aRequest); - - if ( ( (moduleName == null) || moduleName.equals(""))) { - _sendStartPage(aResponse, aRequest, aResponse.getWriter(), - userEntity); - } - else if (moduleName.equals("login")) { - String target = (String) session.getAttribute("login.target"); - - if (target != null) { - ServletHelper.redirect(aResponse, target); - } - else { - _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity); - } - } - else if (moduleName.equals("logout")) { - logger.info(userEntity.get("login") + " has logged out"); - session.invalidate(); - _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); - return; - } - else { - try { - ServletModule servletModule = getServletModuleForName(moduleName); - ServletModuleDispatch.dispatch(servletModule, aRequest, aResponse); - - sessionConnectTime = System.currentTimeMillis() - startTime; - logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms"); - } - catch (Throwable e) { - Throwable cause = ExceptionFunctions.traceCauseException(e); - - if (cause instanceof ServletModuleUserExc) - handleUserError(aRequest, aResponse, aResponse.getWriter(), - (ServletModuleUserExc) cause); - else - handleError(aRequest, aResponse, aResponse.getWriter(), cause); - } - - if (aRequest.getParameter("killsession")!=null) - aRequest.getSession().invalidate(); - } - } - } - catch (Throwable t) { - t.printStackTrace(); - - throw new ServletException(t.toString()); - } - } - - /** - * Private method getServletModuleForName returns ServletModule - * from Cache - * - * @param moduleName - * @return ServletModule - * - */ - private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc { - // Instance in Map ? - if (!servletModuleInstanceHash.containsKey(moduleName)) { - // was not found in hash... - try { - Class theServletModuleClass = null; - - try { - // first we try to get ServletModule from stern.che3.servlet - theServletModuleClass = - Class.forName("mircoders.servlet.ServletModule" + moduleName); - } catch (ClassNotFoundException e) { - // on failure, we try to get it from lib-layer - theServletModuleClass = - Class.forName("mir.servlet.ServletModule" + moduleName); - } - - Method m = theServletModuleClass.getMethod("getInstance", null); - ServletModule smod = (ServletModule) m.invoke(null, null); - - // we put it into map for further reference - servletModuleInstanceHash.put(moduleName, smod); - - return smod; - } - catch (Exception e) { - throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage()); - } - } - else { - return (ServletModule) servletModuleInstanceHash.get(moduleName); - } - } - - private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse, - PrintWriter out, ServletModuleUserExc anException) { - try { - logger.info("user error: " + anException.getMessage()); - SimpleHash modelRoot = new SimpleHash(); - MessageResources messages = MessageResources.getMessageResources("bundles.admin"); - modelRoot.put("errorstring", - new SimpleScalar( - messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters()) - )); - modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); - HTMLTemplateProcessor.process( - aResponse, - MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"), - modelRoot, - null, - out, - getLocale(aRequest), - fallbackLocale); - out.close(); - } - catch (Throwable e) { - logger.error("Error handling user error" + e.toString()); - } - } - - private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) { - try { - logger.error("error: " + anException); - SimpleHash modelRoot = new SimpleHash(); - modelRoot.put("errorstring", new SimpleScalar(anException.getMessage())); - modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime( - new GregorianCalendar()))); - HTMLTemplateProcessor.process( - aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"), - modelRoot,null,out, getLocale(aRequest), getFallbackLocale()); - out.close(); - } - catch (Throwable e) { - logger.error("Error handling error: " + e.toString()); - } - } - - // Redirect-methods - private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest, - PrintWriter out) { - String loginTemplate = configuration.getString("Mir.LoginTemplate"); - String sessionUrl = aResponse.encodeURL(""); - - try { - SimpleHash mergeData = new SimpleHash(); - SimpleList languages = new SimpleList(); - - mergeData.put("session", sessionUrl); - - mergeData.put("defaultlanguage", getDefaultLanguage(aRequest)); - mergeData.put("languages", getLoginLanguages()); - - HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale()); - } - catch (Throwable e) { - handleError(aRequest, aResponse, out, e); - } - } - - private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest, - PrintWriter out, EntityUsers userEntity) { - String startTemplate = configuration.getString("Mir.StartTemplate"); - String sessionUrl = aResponse.encodeURL(""); - - try { - Map mergeData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal"); - mergeData.put("messages", - new CachingRewindableIterator( - new EntityIteratorAdapter( "", "webdb_create desc", 10, - MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0))); - - mergeData.put("fileeditentries", ((ServletModuleFileEdit) ServletModuleFileEdit.getInstance()).getEntries()); - mergeData.put("administeroperations", ((ServletModuleLocalizer) ServletModuleLocalizer.getInstance()).getAdministerOperations()); - - mergeData.put("searchvalue", null); - mergeData.put("searchfield", null); - mergeData.put("searchispublished", null); - mergeData.put("searcharticletype", null); - mergeData.put("searchorder", null); - mergeData.put("selectarticleurl", null); - - ServletHelper.generateResponse(out, mergeData, startTemplate); - } - catch (Exception e) { - e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); - handleError(aRequest, aResponse, out, e); - } - } - - public String getServletInfo() { - return "Mir " + configuration.getString("Mir.Version"); - } -} +/* + * Copyright (C) 2001-2006 The Mir-coders group + * + * This file is part of Mir. + * + * Mir is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Mir is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +import mir.bundle.Bundle; +import mir.config.MirPropertiesConfiguration; +import mir.servlet.AbstractServlet; +import mir.servlet.AdminServletModule; +import mir.servlet.ServletModuleExc; +import mir.servlet.ServletModuleUserExc; +import mir.util.ExceptionRoutines; +import mir.util.StringRoutines; +import mircoders.entity.EntityUsers; +import mircoders.global.MirGlobal; +import mircoders.module.ModuleUsers; +import mircoders.servlet.ServletHelper; +import multex.Failure; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.UnavailableException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +public class Mir extends AbstractServlet { + private static ModuleUsers usersModule = null; + private static Locale fallbackLocale = null; + + private static List loginLanguages = null; + + private List getLoginLanguages() throws Failure { + synchronized (Mir.class) { + try { + if (loginLanguages == null) { + List languages = + StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";"); + + loginLanguages = new ArrayList(); + + Iterator i = languages.iterator(); + + while (i.hasNext()) { + String code = (String) i.next(); + + Bundle bundle = + MirGlobal.getBundleFactory().getBundle("etc/bundles/adminlocal", new String[] { code }); + Bundle defaultBundle = + MirGlobal.getBundleFactory().getBundle("bundles/admin", new String[] { code }); + + String name = bundle.getValue("languagename", Collections.EMPTY_LIST); + + if (name == null) { + name = defaultBundle.getValue("languagename", Collections.EMPTY_LIST); + } + + if (name == null) { + name = code; + } + + Map record = new HashMap(); + record.put("name", name); + record.put("code", code); + loginLanguages.add(record); + } + } + + return loginLanguages; + } + catch (Throwable t) { + throw new Failure("Error while retrieving the available login languages", t); + } + } + } + + public void init(ServletConfig config) throws ServletException { + super.init(config); + + usersModule = new ModuleUsers(); + } + + protected String getDefaultLanguage(HttpServletRequest aRequest) { + String defaultlanguage = + MirGlobal.config().getString("Mir.Login.DefaultLanguage", ""); + + if (defaultlanguage.length() == 0) { + Locale locale = aRequest.getLocale(); + defaultlanguage = locale.getLanguage(); + } + + return defaultlanguage; + } + + protected synchronized Locale getFallbackLocale() throws ServletException { + try { + if (fallbackLocale == null) { + fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), ""); + } + } + catch (Throwable t) { + throw new ServletException(t.getMessage()); + } + + return fallbackLocale; + } + + public EntityUsers checkCredentials(HttpServletRequest aRequest) throws ServletException { + try { + EntityUsers user = ServletHelper.getUser(aRequest); + + String username = aRequest.getParameter("login"); + String password = aRequest.getParameter("password"); + + if (username != null && password != null) { + user = usersModule.getUserForLogin(username, password); + + if (user!=null) { + ServletHelper.setUser(aRequest, user); + usersModule.recordLogin(user); + aRequest.getSession().setAttribute("sessiontracker", new SessionTracker(username, user.getId())); + } + } + + return user; + } + catch (Throwable t) { + throw new ServletException(t.getMessage()); + } + } + + public void process(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException, IOException, UnavailableException { + try { + long startTime = System.currentTimeMillis(); + long sessionConnectTime = 0; + + HttpSession session = aRequest.getSession(true); + setNoCaching(aResponse); + aResponse.setContentType("text/html; charset=" + + configuration. + getString("Mir.DefaultHTMLCharset", "UTF-8")); + + EntityUsers userEntity = checkCredentials(aRequest); + + if (userEntity == null) { + String queryString = aRequest.getQueryString(); + + if ( (queryString != null) && (queryString.length() != 0) && session.getAttribute("login.target") == null && + (aRequest.getParameter("module")==null || + (!aRequest.getParameter("module").equals("login") && !aRequest.getParameter("module").equals("logout")))) { + session.setAttribute("login.target", queryString); + } + + _sendLoginPage(aResponse, aRequest); + } + else { + String moduleName = aRequest.getParameter("module"); + checkLanguage(session, aRequest); + + if ( ( (moduleName == null) || moduleName.equals(""))) { + moduleName="Admin"; + } + + if (moduleName.equals("login")) { + String target = (String) session.getAttribute("login.target"); + + if (target != null) { + ServletHelper.redirect(aResponse, target); + } + else { + ServletHelper.redirect(aResponse, ""); + } + } + else if (moduleName.equals("logout")) { + logger.info(userEntity.getFieldValue("login") + " has logged out"); + session.invalidate(); + _sendLoginPage(aResponse, aRequest); + return; + } + else { + try { + AdminServletModule servletModule = getServletModuleForName(moduleName); + servletModule.handleRequest(aRequest, aResponse); + + sessionConnectTime = System.currentTimeMillis() - startTime; + logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms"); + } + catch (Throwable e) { + Throwable cause = ExceptionRoutines.traceCauseException(e); + + if (cause instanceof ServletModuleUserExc) + handleUserError(aRequest, aResponse, (ServletModuleUserExc) cause); + else + handleError(aRequest, aResponse, cause); + } + + if (aRequest.getParameter("killsession")!=null) + aRequest.getSession().invalidate(); + } + } + } + catch (Throwable t) { + throw new ServletException(t.toString()); + } + } + + /** + * caching routine to get a module for a module name + * + * @param aModuleName the module name + * @return the requested module + * @throws ServletModuleExc + */ + private static AdminServletModule getServletModuleForName(String aModuleName) throws ServletModuleExc { + return ServletHelper.getServletModule(aModuleName); + } + + private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse, ServletModuleUserExc anException) { + try { + logger.info("user error: " + anException.getMessage()); + + Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] {getLocale(aRequest), getFallbackLocale()}); + + Bundle bundle = + MirGlobal.getBundleFactory().getBundle("etc/bundles/adminlocal", new + String[] { getLocale(aRequest).getLanguage() }); + Bundle defaultBundle = + MirGlobal.getBundleFactory().getBundle("bundles/admin", new + String[] { getLocale(aRequest).getLanguage() }); + String message = + bundle.getValue(anException.getMessage(), Arrays.asList(anException.getParameters())); + + if (message==null) { + message = + defaultBundle.getValue(anException.getMessage(), Arrays.asList(anException.getParameters())); + } + + responseData.put("errorstring", message); + responseData.put("date", new GregorianCalendar().getTime()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate")); + } + catch (Throwable e) { + logger.error("Error handling user error" + e.toString()); + } + } + + private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse, Throwable anException) { + try { + logger.error("error: " + anException); + + Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] {getLocale(aRequest), getFallbackLocale()}); + + responseData.put("errorstring", anException.toString()); + StringWriter writer = new StringWriter(); + anException.printStackTrace(new PrintWriter(writer)); + responseData.put("stacktrace", writer.toString()); + responseData.put("date", new GregorianCalendar().getTime()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate")); + } + catch (Throwable e) { + logger.error("Error handling error: " + e.toString()); + + try { + Throwable rootException = ExceptionRoutines.traceCauseException(anException); + + PrintWriter writer = aResponse.getWriter(); + writer.println("FATAL Error"); + writer.println("

" + rootException.toString()+"

"); + writer.println(""); + rootException.printStackTrace(writer); + writer.println(""); + writer.println(""); + writer.close(); + } + catch (Throwable t) { + + } + } + } + + // Redirect-methods + private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest) { + String loginTemplate = configuration.getString("Mir.LoginTemplate"); + + try { + Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] {getLocale(aRequest), getFallbackLocale()}); + + responseData.put("defaultlanguage", getDefaultLanguage(aRequest)); + responseData.put("languages", getLoginLanguages()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, loginTemplate); + } + catch (Throwable e) { + handleError(aRequest, aResponse, e); + } + } + + public String getServletInfo() { + return "Mir " + configuration.getString("Mir.Version"); + } + + private class SessionTracker implements HttpSessionBindingListener { + private String name; + private String id; + + public SessionTracker(String aUserName, String anId) { + name = aUserName; + id = anId; + } + + public void valueBound(HttpSessionBindingEvent anEvent) { + MirGlobal.registerLogin(name, id); + } + + public void valueUnbound(HttpSessionBindingEvent anEvent) { + MirGlobal.registerLogout(name, id); + } + } +}