@Override public DriverPortletContext getPortletContext(PortletWindow portletWindow) throws PortletContainerException { return portletContexts.get(portletWindow.getPortletDefinition().getApplication().getName()); }
@Override public PortletMode getPortletMode() { return getPortletWindow().getPortletMode(); }
@Override public WindowState getWindowState() { return getPortletWindow().getWindowState(); }
protected List<String> getResponseContentTypes() { if (responseContentTypes == null) { responseContentTypes = new ArrayList<String>(); PortletDefinition dd = getPortletWindow().getPortletDefinition(); for (Supports sup : dd.getSupports()) { responseContentTypes.add(sup.getMimeType()); } if (responseContentTypes.isEmpty()) { responseContentTypes.add("text/html"); } } return responseContentTypes; }
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 void setNextPossiblePortletModes(Collection<? extends PortletMode> portletModes) { ArgumentUtility.validateNotNull("portletModes", portletModes); if (portletModes.isEmpty()) { throw new IllegalArgumentException("At least one possible PortletMode should be specified."); } ArrayList<PortletMode> modes = new ArrayList<PortletMode>(); for (PortletMode mode : portletModes) { if (isPortletModeAllowed(mode)) { modes.add(mode); } } if (modes.isEmpty()) { modes.add(getPortletWindow().getPortletMode()); } ((PortletHeaderResponseContext) responseContext).setNextPossiblePortletModes(modes); }
private EventDefinition getEventDefintion(PortletWindow portletWindow, QName name) { PortletApplicationDefinition appDD = portletWindow.getPortletDefinition().getApplication(); for (EventDefinition def : appDD.getEventDefinitions()) { if (def.getQName().equals(name)) { return def; } } throw new IllegalStateException(); }
/** * Checks if the attribute name in APPLICATION_SCOPE is in the current * portlet scope. * @param name the attribute name to check. * @return true if the attribute name is in the current portlet scope. * @see #createPortletScopedId(String) */ protected boolean isInCurrentPortletScope(String name) { // Portlet-scoped attribute names MUST start with "javax.portlet.p.", // and contain the ID-name separator '?'. if (name.startsWith(PORTLET_SCOPE_NAMESPACE) && name.indexOf(ID_NAME_SEPARATOR) > -1) { String id = name.substring(PORTLET_SCOPE_NAMESPACE.length(), name.indexOf(ID_NAME_SEPARATOR)); return (id.equals(portletWindow.getId().getStringId())); } // Application-scoped attribute names are not in portlet scope. return false; }
public void setNextPossiblePortletModes(Collection<? extends PortletMode> portletModes) { ArgumentUtility.validateNotNull("portletModes", portletModes); if (portletModes.isEmpty()) { throw new IllegalArgumentException("At least one possible PortletMode should be specified."); } ArrayList<PortletMode> modes = new ArrayList<PortletMode>(); for (PortletMode mode : portletModes) { if (isPortletModeAllowed(mode)) { modes.add(mode); } } if (modes.isEmpty()) { modes.add(getPortletWindow().getPortletMode()); } ((PortletRenderResponseContext) responseContext).setNextPossiblePortletModes(modes); }
private EventDefinition getEventDefintion(QName name) { PortletApplicationDefinition appDD = portletWindow.getPortletDefinition().getApplication(); for (EventDefinition def : appDD.getEventDefinitions()){ if (def.getQName().equals(name)) { return def; } } throw new IllegalStateException(); } }
/** * Creates portlet-scoped ID for the specified attribute name. * Portlet-scoped ID for a given attribute name has the following form: * <code>javax.portlet.p.<ID>?<name></code> * where <code>ID</code> is a unique identification for the portlet window * (assigned by the portal/portlet-container) that must not contain a '?' * character. <code>name</code> is the attribute name. * <p> * Refer to Portlet Specification PLT. 15.3 for more details. * </p> * @param name the attribute name. * @return portlet-scoped ID for the attribute name. */ protected String createPortletScopedId(String name) { StringBuffer buffer = new StringBuffer(); buffer.append(PORTLET_SCOPE_NAMESPACE); buffer.append(portletWindow.getId().getStringId()); buffer.append(ID_NAME_SEPARATOR); buffer.append(name); return buffer.toString(); }
@Override public boolean isAsyncSupported() { return getPortletWindow().getPortletDefinition().isAsyncSupported(); }
public StateAwareResponseImpl(PortletStateAwareResponseContext responseContext) { super(responseContext); this.responseContext = responseContext; this.windowId = responseContext.getPortletWindow().getId().getStringId(); }
private boolean isValueInstanceOfDefinedClass(QName qname, Serializable value) { PortletApplicationDefinition app = portletWindow.getPortletDefinition().getApplication();
@Override public Map<String, String[]> getPrivateRenderParameterMap() { return paramFactory.getResourceRenderParameterMap(window.getId().getStringId()); }
public void setEvent(String name, Serializable value) { PortletWindow window = getPortletWindow(); String defaultNamespace; defaultNamespace = window.getPortletDefinition().getApplication() .getDefaultNamespace(); QName qname = new QName(defaultNamespace, name); setEvent(qname, value); }
@Override public String getWindowID() { return getPortletWindow().getId().getStringId(); }
@Override public String getContextPath() { if (contextPath == null) { contextPath = requestContext.getPortletWindow().getPortletDefinition().getApplication().getContextPath(); } return contextPath; }
@Override public Map<String, String[]> getPrivateParameterMap() { return paramFactory.getPrivateParameterMap(window.getId().getStringId()); }