1 37 38 package com.sun.j2ee.blueprints.consumerwebsite; 39 40 import java.beans.Beans ; 41 import java.util.*; 42 import javax.servlet.http.*; 43 import javax.servlet.*; 44 45 import com.sun.j2ee.blueprints.signon.web.SignOnFilter; 47 48 import com.sun.j2ee.blueprints.customer.*; 50 51 import com.sun.j2ee.blueprints.consumerwebsite.actions.*; 53 54 62 public class SignOnNotifier 63 implements java.io.Serializable , HttpSessionAttributeListener { 64 65 66 public SignOnNotifier() { } 67 68 public void attributeRemoved(HttpSessionBindingEvent se) {} 70 71 76 public void attributeAdded(HttpSessionBindingEvent se) { 77 processEvent(se); 78 } 79 80 83 public void attributeReplaced(HttpSessionBindingEvent se) { 84 processEvent(se); 85 } 86 87 private void processEvent(HttpSessionBindingEvent se) { 88 HttpSession session = se.getSession(); 89 String name = se.getName(); 90 94 if (name.equals(SignOnFilter.SIGNED_ON_USER)) { 95 boolean aSignOn = ((Boolean )se.getValue()).booleanValue(); 96 if (aSignOn) { 97 AdventureComponentManager acm = 98 (AdventureComponentManager)session.getAttribute(AdventureKeys.COMPONENT_MANAGER); 99 CustomerFacade facade = null; 101 105 if (acm != null) { 106 facade = acm.getCustomerFacade(session); 107 CustomerHTMLAction action = new CustomerHTMLAction(); 108 CustomerBean bean = null; 109 try { 110 bean = action.readAccount(session, facade); 111 } catch (Exception cex) { 112 cex.printStackTrace(); 114 } 115 session.setAttribute(AdventureKeys.CUSTOMER_BEAN, bean); 116 } 117 } 118 } 119 } 120 121 } 122 123 124 | Popular Tags |