public void run() { try { // set start timestamp this.startTime = System.currentTimeMillis(); // ACEGI-specific thingy: copy security context SecurityContextHolder.setContext(TrackingContextHolder.getContext()); started=true; // invoke container call portletContainer.doRender(portletWindow,req,res); renderContent=res.getPortletRenderContent(); successful=true; done=true; } catch (Throwable t) { problem=t; successful=false; done=true; } }
/** * @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext) */ public void setServletContext(ServletContext servletContext) { try { this.portletContainer.init(servletContext); } catch (PortletContainerException pce) { throw new IllegalStateException("Failed to initialize PortletContainer", pce); } } }
/** * @see org.jasig.portal.portlet.session.IPortletSessionActionManager#setAttribute(org.jasig.portal.portlet.window.IPortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Object, int) */ public void setAttribute(IPortletWindow portletWindow, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, String name, Object value, int scope) throws PortletException, IOException, PortletContainerException { final PortletWindow plutoPortletWindow = plutoDomainObjectHelper.getPortletWindow(portletWindow); httpServletRequest.setAttribute(this.controllerAttributeName, this.listenerName); httpServletRequest.setAttribute(PortletSessionAdministrativeRequestListener.ACTION, PortletSessionAdministrativeRequestListener.SessionAction.SET_ATTRIBUTE); httpServletRequest.setAttribute(PortletSessionAdministrativeRequestListener.ARGUMENTS, new Object[] { name, value }); httpServletRequest.setAttribute(PortletSessionAdministrativeRequestListener.SCOPE, scope); try { this.portletContainer.doAdmin(plutoPortletWindow, httpServletRequest, httpServletResponse); } catch (org.apache.pluto.PortletContainerException pce) { throw new PortletContainerException("Failed to execute Pluto admin request", pce); } finally { httpServletRequest.removeAttribute(PortletSessionAdministrativeRequestListener.ACTION); httpServletRequest.removeAttribute(PortletSessionAdministrativeRequestListener.ARGUMENTS); httpServletRequest.removeAttribute(PortletSessionAdministrativeRequestListener.SCOPE); } } }
public void processPortletAction(IPortletWindow window, Map<String, String[]> actionParams, IUser user, HttpServletRequest req, HttpServletResponse res) throws PortletRenderingException { PortletWindow plutoWindow=plutoDomainObjectHelper.getPortletWindow(window); PortletHttpServletRequestWrapper wrappedRequest=new PortletHttpServletRequestWrapper(req, actionParams, user); PortletHttpServletResponseWrapper wrappedResponse=new PortletHttpServletResponseWrapper(plutoWindow.getId(),req,res,renderContentAccessor); try { portletContainer.doAction(plutoWindow,wrappedRequest,wrappedResponse); } catch (Exception e) { throw new PortletRenderingException(window.getPortletWindowId(),e); } }
/** * Create a new render response instance * @param internalWindow portlet window * @param req http request * @param res http response - must be an instance of {@link PortletHttpServletResponseWrapper} */ public PortletRenderResponseImpl(PortletContainer container, InternalPortletWindow internalWindow, HttpServletRequest req, HttpServletResponse res, ILocaleManager localeManager,IPortletUrlFactory portletUrlFactory,IPlutoDomainObjectHelper plutoHelper) { //TODO look at how to deal with containerSupportsBuffering super(container, internalWindow, req, new RecordingHttpServletResponseWrapper(res)); // argh ! this.wrappedResponse=(RecordingHttpServletResponseWrapper)getResponse(); this.req=req; this.plutoWindow=internalWindow.getOriginalPortletWindow(); this.window=plutoHelper.getPortletWindow(plutoWindow); this.portletUrlFactory=portletUrlFactory; this.callbackService=container.getRequiredContainerServices().getPortalCallbackService(); // associate content with the response if(res instanceof PortletHttpServletResponseWrapper) { ((PortletHttpServletResponseWrapper)res).setPortletRenderContent(this); } else { throw new IllegalArgumentException("response must be an instance of PortletHttpServletResponseWrapper"); } // set up title LocalizedPortletDefinitionImpl lpd=new LocalizedPortletDefinitionImpl(window.getPortletEntity().getPortletDefinition(),localeManager); this.title=lpd.getLocalDisplayName(); this.locale=lpd.resolveLocal(); }
protected void notify(PortletInvocationEvent event, boolean pre, Throwable e) { ContainerInvocation inv = containerInvocationService.getInvocation(); PortalAdministrationService pas = inv.getPortletContainer() .getOptionalContainerServices() .getPortalAdministrationService(); Iterator<PortletInvocationListener> i = pas.getPortletInvocationListeners().iterator(); while (i.hasNext()) { PortletInvocationListener listener = i.next(); if (pre) { listener.onBegin(event); } else if (e == null) { listener.onEnd(event); } else { listener.onError(event, e); } } }
portletContainer.doAction(window, new SakaiServletActionRequest(request, state), response);
String helpUrl = null; RequiredContainerServices rs = portletContainer .getRequiredContainerServices(); PortalCallbackService pcs = rs.getPortalCallbackService(); PortletURLProvider pup = null;
.getInvocation(); PortalAdministrationService pas = inv.getPortletContainer() .getOptionalContainerServices() .getPortalAdministrationService();
private void renderResponse() throws ToolRenderException { if (bufferedResponse == null) { bufferedResponse = new BufferedServletResponse(response); try { portletContainer.doRender(window, req, bufferedResponse); } catch (PortletException e) { throw new ToolRenderException(e.getMessage(), e); } catch (IOException e) { throw new ToolRenderException(e.getMessage(), e); } catch (PortletContainerException e) { throw new ToolRenderException(e.getMessage(), e); } } }
private PortletContainer getPortletContainer(ServletContext context) throws PortletContainerException { if (container == null) { container = createPortletContainer(); container.init(context); } return container; }
/** * @see org.jasig.portal.portlet.session.IPortletSessionActionManager#clear(org.jasig.portal.portlet.window.IPortletWindow, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int) */ public void clear(IPortletWindow portletWindow, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, int scope) throws PortletException, IOException, PortletContainerException { final PortletWindow plutoPortletWindow = plutoDomainObjectHelper.getPortletWindow(portletWindow); httpServletRequest.setAttribute(this.controllerAttributeName, this.listenerName); httpServletRequest.setAttribute(PortletSessionAdministrativeRequestListener.ACTION, PortletSessionAdministrativeRequestListener.SessionAction.CLEAR); httpServletRequest.setAttribute(PortletSessionAdministrativeRequestListener.SCOPE, scope); try { this.portletContainer.doAdmin(plutoPortletWindow, httpServletRequest, httpServletResponse); } catch (org.apache.pluto.PortletContainerException pce) { throw new PortletContainerException("Failed to execute Pluto admin request", pce); } finally { httpServletRequest.removeAttribute(PortletSessionAdministrativeRequestListener.ACTION); httpServletRequest.removeAttribute(PortletSessionAdministrativeRequestListener.SCOPE); } }
public void startPortletRendering(IPortletWindow window, Map<String, String[]> renderParams, IUser user, HttpServletRequest req, HttpServletResponse res) throws PortletRenderingException { try { PortletWindow plutoWindow=plutoDomainObjectHelper.getPortletWindow(window); // construct wrapped request and response PortletHttpServletRequestWrapper wrappedRequest=new PortletHttpServletRequestWrapper(req, renderParams, user); PortletHttpServletResponseWrapper wrappedResponse=new PortletHttpServletResponseWrapper(plutoWindow.getId(),req,res,renderContentAccessor); // render portletContainer.doRender(plutoWindow,wrappedRequest,wrappedResponse); // record content renderContentAccessor.setRenderedContent(plutoWindow.getId().toString(),wrappedResponse.getPortletRenderContent(),req); } catch (Exception e) { throw new PortletRenderingException(window.getPortletWindowId(),e); } }