Petstore源码追踪记(3)-商业逻辑处理(五)
http://www.rdxx.com 01年11月18日 11:08 互联网 我要投稿
*/
//
判别新增或覆盖属性为”SIGNED_ON_USER”则进行处理,否则略过
if (name.equals(SignOnFilter.SIGNED_ON_USER)) {
boolean aSignOn = ((Boolean)se.getValue()).booleanValue();
if (aSignOn) {
String userName =
(String)session.getAttribute(SignOnFilter.USER_NAME);
//请加入侦察码
System.out.println("SignOnNotifier() userName="+userName);
// look up the model manager and webclient controller
PetstoreComponentManager sl =
(PetstoreComponentManager)session.getAttribute(PetstoreKeys.COMPONENT_MANAGER);
WebController wc = sl.getWebController(session);
SignOnEvent soe = new SignOnEvent(userName);
// set the EJBAction on the Event
EventMapping em = getEventMapping(session.getServletContext(), soe);
if (em != null) {
soe.setEJBActionClassName(em.getEJBActionClassName());
System.out.println("EJBActionClassName="+
em.getEJBActionClassName());
}
try {
//更新资料时会用到,以本例来说只需读取,所以没有作用
wc.handleEvent(soe, session);
} catch (EventException e) {
System.err.println("SignOnNotifier Error handling event " + e);
}
//取得Customer EJB Local Interface Reference
CustomerLocal customer = sl.getCustomer(session);
// ensure the customer object is put in the session
//将Customer EJB Local Interface存入Session
if (session.getAttribute(PetstoreKeys.CUSTOMER) == null) {
session.setAttribute(PetstoreKeys.CUSTOMER, customer);
}
// set the language to the preferred language and other preferences
ProfileLocal profile = sl.getCustomer(session).getProfile();
