public void admin(PortletRequestContext requestContext, PortletRequest request, PortletResponse response) throws IOException, PortletException, PortletContainerException { throw new PortletContainerException("Unsupported action ADMIN"); }
/** * Stores the portlet preferences to a persistent storage. If a preferences * validator is defined for this portlet, this method firstly validates the * portlet preferences. * <p> * This method is invoked internally, thus it does not check the portlet * request method ID (METHOD_RENDER or METHOD_ACTION). * </p> * @throws ValidatorException if the portlet preferences are not valid. * @throws IOException if an error occurs with the persistence mechanism. */ protected final void internalStore() throws IOException, ValidatorException { // Validate the preferences before storing, if a validator is defined. // If the preferences cannot pass the validation, // an ValidatorException will be thrown out. PortletDefinition portletD = window.getPortletDefinition(); PreferencesValidator validator = preferencesService.getPreferencesValidator(portletD); if (validator != null) { validator.validate(this); } // Store the portlet preferences. try { preferencesService.store(window, request, preferences); } catch (PortletContainerException ex) { LOG.error("Error storing preferences.", ex); throw new IOException("Error storing perferences: " + ex.getMessage()); } }
/** * Get a portlet descriptor matching the current portlet definition form. If the current form * does not represent a portlet, the application or portlet name fields are blank, or the * portlet description cannot be retrieved, the method will return <code>null</code>. * * @param form * @return */ public PortletDefinition getPortletDescriptor(PortletDefinitionForm form) { final Tuple<String, String> portletDescriptorKeys = this.getPortletDescriptorKeys(form); if (portletDescriptorKeys == null) { return null; } final String portletAppId = portletDescriptorKeys.first; final String portletName = portletDescriptorKeys.second; final PortletRegistryService portletRegistryService = portalDriverContainerServices.getPortletRegistryService(); try { return portletRegistryService.getPortlet(portletAppId, portletName); } catch (PortletContainerException e) { e.printStackTrace(); return null; } }
context.log(ex.getMessage(), ex);
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; }
@Override public DriverPortletConfig getPortletConfig(String applicationName, String portletName) throws PortletContainerException { DriverPortletConfig ipc = portletConfigs.get(applicationName + "/" + portletName); if (ipc != null) { return ipc; } String msg = "Unable to locate portlet config [applicationName=" + applicationName + "]/[" + portletName + "]."; logger.warn(msg); throw new PortletContainerException(msg); }
LOG.warn(e.getMessage(), e); } catch (PortletContainerException e) { LOG.warn(e.getMessage(), e);
@Override public PortletApplicationDefinition getPortletApplication(String applicationName) throws PortletContainerException { DriverPortletContext ipc = portletContexts.get(applicationName); if (ipc != null) { return ipc.getPortletApplicationDefinition(); } String msg = "Unable to retrieve portlet application: '" + applicationName + "'"; logger.warn(msg); throw new PortletContainerException(msg); }
LOG.warn(e.getMessage(),e); } catch (PortletContainerException e) { LOG.warn(e.getMessage(),e);
@Override public PortletDefinition getPortlet(String applicationName, String portletName) throws PortletContainerException { DriverPortletConfig ipc = portletConfigs.get(applicationName + "/" + portletName); if (ipc != null) { return ipc.getPortletDefinition(); } String msg = "Unable to retrieve portlet: '" + applicationName + "/" + portletName + "'"; logger.warn(msg); throw new PortletContainerException(msg); }
LOG.warn(e.getMessage(), e);
InputStream webIn = servletContext.getResourceAsStream(WEB_XML); if (paIn == null) { throw new PortletContainerException( "Cannot find '" + PORTLET_XML throw new PortletContainerException( "Cannot find '" + WEB_XML this.portletAppDescriptorService.mergeWebDescriptor(portletApp, webIn); } catch (Exception ex) { throw new PortletContainerException( "Exception loading portlet descriptor for: " + servletContext.getServletContextName(),
public boolean isPortletModeSupportedByPortlet(String portletId, String mode) { // View mode is always supported if (mode.equalsIgnoreCase(PortletMode.VIEW.toString())) { return true; } String applicationId = PortletWindowConfig.parseContextPath(portletId); String applicationName = applicationId; String portletName = PortletWindowConfig.parsePortletName(portletId); try { if (portletRegistry == null) { LOG.error("Optional Portlet Registry Service not found."); throw new PortletContainerException("Optional Portlet Registry Service not found."); } PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName); for (Supports sd : ctx.getPortlet(portletName).getSupports()) { if (sd.getMimeType().matches("(?:\\*|\\*/\\*|text/html|text/\\*)")) { for (String pm : sd.getPortletModes()) { if (pm.equalsIgnoreCase(mode)) { return true; } } } } } catch (PortletContainerException e) { LOG.error("Error determining mode support.", e); } LOG.info("Portlet mode '" + mode + "' not found for portletId: '" + portletId + "'"); return false; }
/** * Gets all modes supported by a portlet that are defined in the portlet's supports child element in portlet.xml. * * @param portletId * of interest. * @return all portlet modes supported by a portlet. */ public Set<PortletMode> getSupportedPortletModes(String portletId) throws PortletContainerException { Set<PortletMode> modeSet = new HashSet<PortletMode>(); modeSet.add(PortletMode.VIEW); // view is always supported String applicationId = PortletWindowConfig.parseContextPath(portletId); String applicationName = applicationId; String portletName = PortletWindowConfig.parsePortletName(portletId); if (portletRegistry == null) { LOG.error("Optional Portlet Registry Service not found."); throw new PortletContainerException("Optional Portlet Registry Service not found."); } PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName); for (Supports sd : portletApp.getPortlet(portletName).getSupports()) { if (sd.getMimeType().matches("(?:\\*|\\*/\\*|text/html|text/\\*)")) { for (String pm : sd.getPortletModes()) { modeSet.add((new PortletMode(pm))); } } } return modeSet; }
String appName = portletContext.getApplicationName(); if (appName == null) { throw new PortletContainerException( "Portlet application name should not be null.");
throw new PortletContainerException(e); throw new PortletContainerException(e);