public void handleEventRequest( EventRequest request, EventResponse response) throws Exception { if (!(this.portletInstance instanceof EventPortlet)) { logger.debug("Ignoring event request for non-event target portlet: " + this.portletInstance.getClass()); return; } EventPortlet eventPortlet = (EventPortlet) this.portletInstance; // Delegate to PortletContentGenerator for checking and preparing. check(request, response); // Execute in synchronized block if required. if (isSynchronizeOnSession()) { PortletSession session = request.getPortletSession(false); if (session != null) { Object mutex = PortletUtils.getSessionMutex(session); synchronized (mutex) { eventPortlet.processEvent(request, response); return; } } } eventPortlet.processEvent(request, response); }
@Test public void beanMgrTest() throws Exception { assertNotNull(bm); Set<Bean<?>> beans = bm.getBeans(TestPortlet1.class); Bean<?> bean = bm.resolve(beans); assertNotNull(bean); CreationalContext<?> coco = bm.createCreationalContext(bean); assertNotNull(coco); Object obj = bm.getReference(bean, TestPortlet1.class, coco); assertNotNull(obj); assertTrue(obj instanceof GenericPortlet); assertTrue(obj instanceof Portlet); assertTrue(obj instanceof HeaderPortlet); assertTrue(obj instanceof EventPortlet); assertTrue(obj instanceof ResourceServingPortlet); Object obj2 = bm.getReference(bean, TestPortlet1.class, coco); assertNotNull(obj2); assertFalse(obj.equals(obj2)); assertFalse(obj == obj2); }
@Test public void appScopedTest() throws Exception { assertNotNull(bm); Set<Bean<?>> beans = bm.getBeans(TestPortlet1AppScoped.class); Bean<?> bean = bm.resolve(beans); assertNotNull(bean); CreationalContext<?> coco = bm.createCreationalContext(bean); assertNotNull(coco); Object obj = bm.getReference(bean, TestPortlet1AppScoped.class, coco); assertNotNull(obj); assertTrue(obj instanceof GenericPortlet); assertTrue(obj instanceof Portlet); assertTrue(obj instanceof HeaderPortlet); assertTrue(obj instanceof EventPortlet); assertTrue(obj instanceof ResourceServingPortlet); Object obj2 = bm.getReference(bean, TestPortlet1AppScoped.class, coco); assertNotNull(obj2); assertTrue(obj.equals(obj2)); assertTrue(obj == obj2); }
@Override public void handleEventRequest( EventRequest request, EventResponse response) throws Exception { if (!(this.portletInstance instanceof EventPortlet)) { logger.debug("Ignoring event request for non-event target portlet: " + this.portletInstance.getClass()); return; } EventPortlet eventPortlet = (EventPortlet) this.portletInstance; // Delegate to PortletContentGenerator for checking and preparing. check(request, response); // Execute in synchronized block if required. if (isSynchronizeOnSession()) { PortletSession session = request.getPortletSession(false); if (session != null) { Object mutex = PortletUtils.getSessionMutex(session); synchronized (mutex) { eventPortlet.processEvent(request, response); return; } } } eventPortlet.processEvent(request, response); }
@Override public void handleEvent(EventRequest request, EventResponse response, Object handler) throws Exception { if (handler instanceof EventPortlet) { ((EventPortlet) handler).processEvent(request, response); } else { // if no event processing method was found just keep render params response.setRenderParameters(request); } }
public void handleEvent(EventRequest request, EventResponse response, Object handler) throws Exception { if (handler instanceof EventPortlet) { ((EventPortlet) handler).processEvent(request, response); } else { // if no event processing method was found just keep render params response.setRenderParameters(request); } }
@Test public void appScopedTest2Coco() throws Exception { assertNotNull(bm); Set<Bean<?>> beans = bm.getBeans(TestPortlet1AppScoped.class); Bean<?> bean = bm.resolve(beans); assertNotNull(bean); CreationalContext<?> coco1 = bm.createCreationalContext(bean); assertNotNull(coco1); Object obj = bm.getReference(bean, TestPortlet1AppScoped.class, coco1); assertNotNull(obj); assertTrue(obj instanceof GenericPortlet); assertTrue(obj instanceof Portlet); assertTrue(obj instanceof HeaderPortlet); assertTrue(obj instanceof EventPortlet); assertTrue(obj instanceof ResourceServingPortlet); CreationalContext<?> coco2 = bm.createCreationalContext(bean); assertNotNull(coco2); Object obj2 = bm.getReference(bean, TestPortlet1AppScoped.class, coco2); assertNotNull(obj2); assertTrue(obj.equals(obj2)); assertTrue(obj == obj2); }
@Test public void appScopedTest2Coco2Bean() throws Exception { assertNotNull(bm); Set<Bean<?>> beans1 = bm.getBeans(TestPortlet1AppScoped.class); Bean<?> bean1 = bm.resolve(beans1); assertNotNull(bean1); CreationalContext<?> coco1 = bm.createCreationalContext(bean1); assertNotNull(coco1); Object obj = bm.getReference(bean1, TestPortlet1AppScoped.class, coco1); assertNotNull(obj); assertTrue(obj instanceof GenericPortlet); assertTrue(obj instanceof Portlet); assertTrue(obj instanceof HeaderPortlet); assertTrue(obj instanceof EventPortlet); assertTrue(obj instanceof ResourceServingPortlet); Set<Bean<?>> beans2 = bm.getBeans(TestPortlet1AppScoped.class); Bean<?> bean2 = bm.resolve(beans2); assertNotNull(bean2); CreationalContext<?> coco2 = bm.createCreationalContext(bean2); assertNotNull(coco2); Object obj2 = bm.getReference(bean2, TestPortlet1AppScoped.class, coco2); assertNotNull(obj2); assertTrue(obj.equals(obj2)); assertTrue(obj == obj2); assertEquals(bean1, bean2); assertNotEquals(coco1, coco2); }
public void processFilter(EventRequest req, EventResponse res, EventPortlet eventPortlet, PortletContext portletContext) throws IOException, PortletException { this.eventPortlet = eventPortlet; this.loader = Thread.currentThread().getContextClassLoader(); this.portletContext = portletContext; doFilter(req, res); }
/** * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.EventRequest, javax.portlet.EventResponse, javax.portlet.EventPortlet, javax.portlet.PortletContext) */ @Override public void processFilter(EventRequest req, EventResponse res, EventPortlet eventPortlet,PortletContext portletContext)throws PortletException, IOException{ filterchain.processFilter(req, res, eventPortlet, portletContext); }
void processFilter(EventRequest req, EventResponse res, EventPortlet eventPortlet, PortletContext portletContext)throws PortletException, IOException;