1 9 package org.jboss.portal.bridge; 10 11 import org.jboss.portal.server.invocation.Interceptor; 12 import org.jboss.portal.server.invocation.Invocation; 13 import org.jboss.portal.server.invocation.AttachmentKey; 14 import org.jboss.portal.server.Window; 15 import org.jboss.portal.server.Instance; 16 import org.jboss.portal.server.Component; 17 import org.jboss.portal.server.Application; 18 import org.jboss.portal.server.PortalRequest; 19 import org.jboss.portal.server.PortalResponse; 20 import org.jboss.portal.portlet.impl.DispatchedHttpServletRequest; 21 22 import javax.servlet.http.HttpServletResponse ; 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.ServletContext ; 25 import java.net.MalformedURLException ; 26 import java.net.URL ; 27 28 34 public class BridgeInterceptor implements Interceptor 35 { 36 public Object invoke(Invocation invocation) 37 { 38 39 Window window = (Window)invocation.getAttachment(AttachmentKey.WINDOW); 41 Instance instance = window.getInstance(); 42 Component component = instance.getComponent(); 43 Application application = component.getApplication(); 44 ServletContext ctx = application.getServletContext(); 45 46 PortalRequest preq = (PortalRequest)invocation.getAttachment(AttachmentKey.PORTAL_REQUEST); 48 PortalResponse presp = (PortalResponse)invocation.getAttachment(AttachmentKey.PORTAL_RESPONSE); 49 HttpServletRequest req = (HttpServletRequest)invocation.getAttachment(AttachmentKey.DISPATCHED_REQUEST); 50 HttpServletResponse resp = (HttpServletResponse )invocation.getAttachment(AttachmentKey.DISPATCHED_RESPONSE); 51 52 try 53 { 54 JBossServletContextProvider.BridgeInfo bridgeInfo = new JBossServletContextProvider.BridgeInfo(ctx, preq, presp, req, resp); 56 JBossServletContextProvider.set(bridgeInfo); 57 58 return invocation.invokeNext(); 60 } 61 finally 62 { 63 JBossServletContextProvider.set(null); 65 } 66 } 67 } 68 | Popular Tags |