protected PortletRegistryService getPortletRegistryService() { return this.optionalContainerServices.getPortletRegistryService(); } }
/** * @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); } } }
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); } } }
public void setTitle(HttpServletRequest request, PortletWindow window, String title) { LOG.debug("Setting portlet title for window '" + window.getId() + "' to '" + title + "'."); PortletStateAccess.getPortletState(request, window.getId().getStringId()) .setTitle(title); }
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); } }
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); } } }
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); } }
/** * Constructs and returns the attribute key of the properties for the given portlet window. */ private String getPropertiesAttributeKey(PortletWindow window) { return PortalCallbackService.class.getName() + "_" + window.getId().toString(); }
private PortletContainer createPortletContainer() throws PortletContainerException { SakaiPortletContainerServices services = new SakaiPortletContainerServices(); SakaiOptionalPortletContainerServices optServices = new SakaiOptionalPortletContainerServices(); services.setPortalCallbackService(new SakaiPortalCallbackService()); services.setPortalContext(new SakaiPortalContext()); return PortletContainerFactory.getInstance().createContainer("sakai", services, optServices); }
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.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 String getTitle() throws ToolRenderException { if ( bufferedException == null ) { try { renderResponse(); return Web.escapeHtml(PortletStateAccess.getPortletState(req, window.getId().getStringId()) .getTitle()); } catch(Exception e) { bufferedException = e; } } return bufferedException.toString(); }
public Map getRequestProperties(HttpServletRequest request, PortletWindow window) { PortletState currentState = PortletStateAccess.getPortletState(request, window .getId().getStringId()); return currentState.getRequestProperties(); }
private PortletWindowId getWindowId(PortletWindow portletWindow) { return new PortletWindowId(portletWindow.getId().toString()); } /**
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 setResponseProperty(HttpServletRequest request, PortletWindow window, String key, String value) { PortletState currentState = PortletStateAccess.getPortletState(request, window .getId().getStringId()); currentState.getResponseProperties().put(key, value); }
public IPortletRenderContent getPortletRenderContent(IPortletWindow window, HttpServletRequest req, HttpServletResponse res) throws PortletRenderingException { PortletWindow plutoWindow=plutoDomainObjectHelper.getPortletWindow(window); IPortletRenderContent content=renderContentAccessor.getRenderedContent(plutoWindow.getId().toString(),req); return content; }
public void addResponseProperty(HttpServletRequest request, PortletWindow window, String key, String value) { PortletState currentState = PortletStateAccess.getPortletState(request, window .getId().getStringId()); currentState.getResponseProperties().put(key, value); }
public PortletURLProvider getPortletURLProvider(HttpServletRequest request, PortletWindow window) { PortletState currentState = PortletStateAccess.getPortletState(request, window .getId().getStringId()); PortletState state = null; if (currentState != null) { state = new PortletState(currentState); } else { state = new PortletState(window.getId().getStringId()); } String baseUrl = request.getRequestURI(); return new SakaiPortletURLProvider(baseUrl, state); }