1 20 package org.enhydra.barracuda.contrib.dbroggisch.page; 21 22 import javax.servlet.http.HttpServletRequest ; 23 import org.enhydra.barracuda.core.event.ControlEventContext; 24 import org.enhydra.barracuda.core.event.DefaultEventDispatcher; 25 import org.enhydra.barracuda.core.event.EventBroker; 26 import org.enhydra.barracuda.core.event.EventContext; 27 import org.enhydra.barracuda.core.event.EventException; 28 import javax.servlet.http.HttpSession ; 29 30 31 47 public class PageEventDispatcher extends DefaultEventDispatcher { 48 49 53 public static boolean PAGE_SYNCHRONIZATION_ACTIVATED = true; 54 private RenderPage _rpe = new RenderPage(); 55 56 63 public void dispatchEvent(EventBroker eb, EventContext context) throws EventException { 64 context.putState(DefaultEventDispatcher.DEFAULT_RESPONSE_EVENT, _rpe); 65 66 if (PAGE_SYNCHRONIZATION_ACTIVATED) { 67 HttpServletRequest req = ((ControlEventContext)context).getRequest(); 68 HttpSession session = req.getSession(false); 69 if (session != null && session.getAttribute(PageFactory.PAGE_KEY) != null) { 70 Object synchee = new Object (); 71 if (session.getAttribute(PageFactory.SYNCHEE) == null) { 72 session.setAttribute(PageFactory.SYNCHEE, synchee); 73 } 74 synchronized(synchee) { 75 super.dispatchEvent(eb, context); 76 } 77 return; 78 } 79 } 80 super.dispatchEvent(eb, context); 81 } 82 83 } 84 | Popular Tags |