public EventProviderImpl(PortletWindow portletWindow, PortletRegistryService portletRegistry) { this.portletWindow = portletWindow; this.portletRegistry = portletRegistry; if (LOG.isTraceEnabled()) { StringBuilder txt = new StringBuilder(128); txt.append("Portlet window: ").append(portletWindow.getId().getStringId()); LOG.debug(txt.toString()); } }
public StateAwareResponseImpl(PortletStateAwareResponseContext responseContext) { super(responseContext); this.responseContext = responseContext; this.windowId = responseContext.getPortletWindow().getId().getStringId(); }
@Override public Map<String, String[]> getPrivateRenderParameterMap() { return paramFactory.getResourceRenderParameterMap(window.getId().getStringId()); }
@Override public String getWindowID() { return getPortletWindow().getId().getStringId(); }
@Override public Map<String, String[]> getPrivateParameterMap() { return paramFactory.getPrivateParameterMap(window.getId().getStringId()); }
@Override public Map<String, String[]> getPublicParameterMap() { return paramFactory.getPublicParameterMap(window.getId().getStringId()); }
@Override public Map<String, String[]> getParameterMap() { return paramFactory.getParameterMap(window.getId().getStringId()); }
protected BaseURLImpl(PortletResponseContext responseContext, PortletURLProvider urlProvider) { this.responseContext = responseContext; this.portalContext = responseContext.getContainer() .getContainerServices().getPortalContext(); this.windowId = responseContext.getPortletWindow().getId().getStringId(); this.urlProvider = urlProvider; renderURL = PortletURLProvider.TYPE.RENDER == urlProvider.getType(); if (isTrace) { StringBuilder txt = new StringBuilder(); txt.append("URL provider type=").append(urlProvider.getType()); txt.append(", WindowId=").append(windowId); txt.append(", isRender=").append(renderURL); LOGGER.debug(txt.toString()); } }
@Override public IPortletWindow convertPortletWindow( HttpServletRequest request, PortletWindow plutoPortletWindow) { Validate.notNull(request, "request can not be null"); Validate.notNull(plutoPortletWindow, "portletWindow can not be null"); // Conver the pluto portlet window ID into a uPortal portlet window ID final PortletWindowID plutoWindowId = plutoPortletWindow.getId(); final IPortletWindowId portletWindowId; if (plutoWindowId instanceof IPortletWindowId) { portletWindowId = (IPortletWindowId) plutoWindowId; } else { portletWindowId = this.getPortletWindowId(request, plutoWindowId.getStringId()); } // Do a new get to make sure the referenced data gets updated correctly return this.getPortletWindow(request, portletWindowId); }
@Override public IPortletWindow convertPortletWindow( HttpServletRequest request, PortletWindow plutoPortletWindow) { Validate.notNull(request, "request can not be null"); Validate.notNull(plutoPortletWindow, "portletWindow can not be null"); // Conver the pluto portlet window ID into a uPortal portlet window ID final PortletWindowID plutoWindowId = plutoPortletWindow.getId(); final IPortletWindowId portletWindowId; if (plutoWindowId instanceof IPortletWindowId) { portletWindowId = (IPortletWindowId) plutoWindowId; } else { portletWindowId = this.getPortletWindowId(request, plutoWindowId.getStringId()); } // Do a new get to make sure the referenced data gets updated correctly return this.getPortletWindow(request, portletWindowId); }
@SuppressWarnings("unchecked") @Override public void setTitle(String title) { if (!isClosed()) { Map<String, String> titles = (Map<String, String>) getServletRequest().getAttribute(AttributeKeys.PORTLET_TITLE); if (titles == null) { titles = new HashMap<String, String>(); getServletRequest().setAttribute(AttributeKeys.PORTLET_TITLE, titles); } String key = getPortletWindow().getId().getStringId(); titles.put(key, title); } }
public String getNamespace() { if (namespace == null) { namespace = getPortletContainer().getContainerServices().getNamespaceMapper().encode(getPortletWindow().getId(), ""); StringBuffer validNamespace = new StringBuffer(); for (int i = 0; i < namespace.length(); i++) { char ch = namespace.charAt(i); if (Character.isJavaIdentifierPart(ch)) { validNamespace.append(ch); } else { validNamespace.append('_'); } } namespace = validNamespace.toString(); } return namespace; }
@SuppressWarnings("unchecked") public void setTitle(String title) { if (!isClosed()) { Map<String, String> titles = (Map<String, String>) getServletRequest().getAttribute(AttributeKeys.PORTLET_TITLE); if (titles == null) { titles = new HashMap<String, String>(); getServletRequest().setAttribute(AttributeKeys.PORTLET_TITLE, titles); } String key = getPortletWindow().getId().getStringId(); titles.put(key, title); } } }
@Override public HttpSession getSession() { HttpSession sess = null; PortletConfig portletConfig = getPortletConfig(); Map<String, String[]> containerRuntimeOptions = portletConfig.getContainerRuntimeOptions(); String[] values = containerRuntimeOptions.get("javax.portlet.servletDefaultSessionScope"); if ((values != null) && (values.length > 0) && "PORTLET_SCOPE".equals(values[0])) { String portletWindowId = getPortletWindow().getId().getStringId(); sess = ServletPortletSessionProxy.createProxy(getServletRequest(), portletWindowId); } return sess; }
protected String encodeAttributeName(String name) { if (isReservedAttributeName(name)) { return name; } return container.getContainerServices().getNamespaceMapper().encode(window.getId(), name); }
protected String decodeAttributeName(String name) { if (isReservedAttributeName(name)) { return name; } String result = container.getContainerServices().getNamespaceMapper().decode(window.getId(), name); return result != null ? result : name; }
@Override public void close() { if (!isClosed()) { super.close(); if (isDebug) { LOGGER.debug("Applying the changes."); } PortalURL url = portletURLProvider.apply(); if (isDebug) { LOGGER.debug("Merging."); } PortalRequestContext.getContext(getServletRequest()).mergePortalURL(url, getPortletWindow().getId().getStringId()); if (isDebug) { LOGGER.debug("exiting."); } } }
private boolean isDeclaredAsPublishingEvent(QName qname) { String applicationId = PortletWindowConfig.parseContextPath(portletWindow.getId().getStringId()); String applicationName = applicationId; String portletName = PortletWindowConfig.parsePortletName(portletWindow.getId().getStringId()); List<? extends EventDefinitionReference> events = null; try { events = portletRegistry.getPortlet(applicationName, portletName).getSupportedPublishingEvents(); } catch (PortletContainerException e1) { e1.printStackTrace(); } if (events != null) { for (EventDefinitionReference ref : events) { QName name = ref.getQualifiedName(); if (name == null) { continue; } if (qname.equals(name)) { return true; } } } return false; }
public HttpServletPortletRequestWrapper(HttpServletRequest hreq, HttpSession session, PortletRequest preq) { super(hreq); this.preq = preq; this.session = session; reqctx = (PortletRequestContext) preq.getAttribute(PortletInvokerService.REQUEST_CONTEXT); this.mapper = reqctx.getContainer().getContainerServices().getNamespaceMapper(); this.winId = reqctx.getPortletWindow().getId(); this.phase = (String) preq.getAttribute(PortletRequest.LIFECYCLE_PHASE); }