1 9 package org.jboss.portal.core.invocation; 10 11 import org.jboss.portal.core.CoreConstants; 12 import org.jboss.portal.core.plugins.page.Page; 13 import org.jboss.portal.core.plugins.page.WindowLocation; 14 import org.jboss.portal.server.Portal; 15 import org.jboss.portal.server.PortalRequest; 16 import org.jboss.portal.server.PortalServer; 17 import org.jboss.portal.server.ServerObjectID; 18 import org.jboss.portal.server.Window; 19 import org.jboss.portal.server.invocation.AttachmentKey; 20 import org.jboss.portal.server.invocation.Interceptor; 21 import org.jboss.portal.server.invocation.Invocation; 22 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 import java.util.List ; 26 27 31 public class ViewInterceptor implements Interceptor 32 { 33 34 public Object invoke(Invocation invocation) 35 { 36 try 37 { 38 PortalRequest req = (PortalRequest)invocation.getAttachment(AttachmentKey.PORTAL_REQUEST); 39 PortalServer container = req.getServer(); 40 Page page = (Page)invocation.getAttachment(CoreAttachmentKey.PAGE); 41 42 Portal portal = page.getRepository().getPortal(); 44 45 List windows = new ArrayList (); 47 for (Iterator i = page.getLocations().iterator(); i.hasNext();) 48 { 49 WindowLocation ref = (WindowLocation)i.next(); 50 ServerObjectID id = ref.getID(); 51 Window window = (Window)container.getObject(id); 52 if (window != null && container.isStarted(window)) 53 { 54 windows.add(window); 58 } 59 } 60 61 113 114 invocation.setAttachment(AttachmentKey.VIEW, windows); 116 invocation.setAttachment(AttachmentKey.PORTAL, portal); 117 return invocation.invokeNext(); 119 } 120 finally 121 { 122 invocation.removeAttachment(AttachmentKey.VIEW); 123 } 124 } 125 } 126 | Popular Tags |