@Override public DriverPortletContext getPortletContext(PortletWindow portletWindow) throws PortletContainerException { return portletContexts.get(portletWindow.getPortletDefinition().getApplication().getName()); }
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; }
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(); }
@Override public boolean isAsyncSupported() { return getPortletWindow().getPortletDefinition().isAsyncSupported(); }
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(); } }
@Override public String getContextPath() { if (contextPath == null) { contextPath = requestContext.getPortletWindow().getPortletDefinition().getApplication().getContextPath(); } return contextPath; }
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); }
protected EventDefinition getEventDefintion(IPortletWindow portletWindow, QName name) { PortletApplicationDefinition appDD = portletWindow.getPlutoPortletWindow().getPortletDefinition().getApplication(); for (EventDefinition def : appDD.getEventDefinitions()) { if (def.getQName() != null) { if (def.getQName().equals(name)) return def; } else { QName tmp = new QName(appDD.getDefaultNamespace(), def.getName()); if (tmp.equals(name)) return def; } } throw new IllegalStateException(); }
public EventProviderImpl( IPortletWindow portletWindow, PortletContextService portletContextService) { this.portletWindow = portletWindow; final PortletDefinition portletDefinition = portletWindow.getPlutoPortletWindow().getPortletDefinition(); final PortletApplicationDefinition application = portletDefinition.getApplication(); final String portletApplicationName = application.getName(); try { this.portletClassLoader = portletContextService.getClassLoader(portletApplicationName); } catch (PortletContainerException e) { throw new IllegalStateException( "Failed to find ClassLoader for portlet applicaiton: " + portletApplicationName, e); } }
public EventProviderImpl( IPortletWindow portletWindow, PortletContextService portletContextService) { this.portletWindow = portletWindow; final PortletDefinition portletDefinition = portletWindow.getPlutoPortletWindow().getPortletDefinition(); final PortletApplicationDefinition application = portletDefinition.getApplication(); final String portletApplicationName = application.getName(); try { this.portletClassLoader = portletContextService.getClassLoader(portletApplicationName); } catch (PortletContainerException e) { throw new IllegalStateException( "Failed to find ClassLoader for portlet applicaiton: " + portletApplicationName, e); } }
/** * @param portletWindowId * @param request * @return */ protected boolean doesPortletNeedHeaderWorker( IPortletWindowId portletWindowId, HttpServletRequest request) { IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId); PortletDefinition portletDefinition = portletWindow.getPlutoPortletWindow().getPortletDefinition(); ContainerRuntimeOption renderHeaderOption = portletDefinition.getContainerRuntimeOption(PORTLET_RENDER_HEADERS_OPTION); boolean result = false; if (renderHeaderOption != null) { result = renderHeaderOption.getValues().contains(Boolean.TRUE.toString()); } logger.debug( "Portlet {} need render header worker: {}", portletDefinition.getPortletName(), result); return result; }
public FilterManagerImpl(PortletWindow portletWindow, String lifeCycle) { final PortletDefinition pd = portletWindow.getPortletDefinition(); this.portletApp = pd.getApplication(); this.portletName = pd.getPortletName(); this.lifeCycle = lifeCycle; filterchain = new FilterChainImpl(lifeCycle); initFilterChain(); }
public FilterManagerImpl(PortletWindow portletWindow, String lifeCycle) { final PortletDefinition pd = portletWindow.getPortletDefinition(); this.portletApp = pd.getApplication(); this.portletName = pd.getPortletName(); this.lifeCycle = lifeCycle; filterchain = new FilterChainImpl(lifeCycle); initFilterChain(); }
public FilterManagerImpl(PortletWindow portletWindow, String lifeCycle) { final PortletDefinition pd = portletWindow.getPortletDefinition(); this.portletApp = pd.getApplication(); this.portletName = pd.getPortletName(); this.lifeCycle = lifeCycle; filterchain = new FilterChainImpl(lifeCycle); initFilterChain(); }
public void setLocale(Locale locale) { if (locale != null) { responseContext.setLocale(locale); if (canSetLocaleEncoding) { String encoding = getPortletWindow().getPortletDefinition().getApplication().getLocaleEncodingMappings().get(locale); if (encoding != null) { setCharacterEncoding(encoding); // allow repeated setLocale usage for characterEncoding canSetLocaleEncoding = true; } } } }
public MimeResponseImpl(PortletMimeResponseContext responseContext) { super(responseContext); this.responseContext = responseContext; PortletDefinition portletDefinition = getPortletWindow() .getPortletDefinition(); getCacheControl().setExpirationTime( portletDefinition.getExpirationCache()); getCacheControl().setPublicScope( PUBLIC_SCOPE.equals(portletDefinition.getCacheScope())); }
private boolean isDeclaredAsPublishingEvent(QName qname) { final PortletDefinition portletDescriptor = this.portletWindow.getPlutoPortletWindow().getPortletDefinition(); final List<? extends EventDefinitionReference> events = portletDescriptor.getSupportedPublishingEvents(); if (events == null) { return false; } final PortletApplicationDefinition application = portletDescriptor.getApplication(); final String defaultNamespace = application.getDefaultNamespace(); for (final EventDefinitionReference ref : events) { final QName name = ref.getQualifiedName(defaultNamespace); if (name == null) { continue; } if (qname.equals(name)) { return true; } } return false; }
private boolean isDeclaredAsPublishingEvent(QName qname) { final PortletDefinition portletDescriptor = this.portletWindow.getPlutoPortletWindow().getPortletDefinition(); final List<? extends EventDefinitionReference> events = portletDescriptor.getSupportedPublishingEvents(); if (events == null) { return false; } final PortletApplicationDefinition application = portletDescriptor.getApplication(); final String defaultNamespace = application.getDefaultNamespace(); for (final EventDefinitionReference ref : events) { final QName name = ref.getQualifiedName(defaultNamespace); if (name == null) { continue; } if (qname.equals(name)) { return true; } } return false; }
/** * Determines whether a user is mapped to the specified role. As specified in PLT-20-3, we must reference the * <security-role-ref> mappings within the deployment descriptor. If no mapping is available, then, and only * then, do we check use the actual role name specified against the web application deployment descriptor. * * @param roleName * the name of the role * @return true if it is determined the user has the given role. */ @Override public boolean isUserInRole(String roleName) { PortletDefinition def = getPortletWindow().getPortletDefinition(); String link = roleName; for (SecurityRoleRef r : def.getSecurityRoleRefs()) { if (r.getRoleName().equals(roleName)) { if (r.getRoleLink() != null) { link = r.getRoleLink(); } break; } } return getServletRequest().isUserInRole(link); }
protected JetspeedPortletInvoker getInvoker(PortletRequestContext requestContext) { JetspeedPortletInvoker invoker; PortletDefinition portletDefinition = (PortletDefinition)requestContext.getPortletWindow().getPortletDefinition(); if (portletDefinition.getApplication().getApplicationType() == PortletApplication.LOCAL) { invoker = new LocalPortletInvoker(portalContext, requestResponseUnwrapper); } else { invoker = new ServletPortletInvoker(requestResponseUnwrapper, servletMappingName); } invoker.activate(portletFactory, portletDefinition, servletConfig); return invoker; } }