public List<PortletApplicationDefinition> getPortletApplications() {
        final PortletRegistryService portletRegistryService =
                portalDriverContainerServices.getPortletRegistryService();
        final List<PortletApplicationDefinition> contexts = new ArrayList<>();

        for (final Iterator<String> iter =
                        portletRegistryService.getRegisteredPortletApplicationNames();
                iter.hasNext(); ) {
            final String applicationName = iter.next();
            final PortletApplicationDefinition applicationDefninition;
            try {
                applicationDefninition =
                        portletRegistryService.getPortletApplication(applicationName);
            } catch (PortletContainerException e) {
                throw new RuntimeException(
                        "Failed to load PortletApplicationDefinition for '"
                                + applicationName
                                + "'");
            }

            final List<? extends PortletDefinition> portlets = applicationDefninition.getPortlets();
            portlets.sort(
                    new ComparableExtractingComparator<PortletDefinition, String>(
                            String.CASE_INSENSITIVE_ORDER) {
                        @Override
                        protected String getComparable(PortletDefinition o) {
                            final List<? extends DisplayName> displayNames = o.getDisplayNames();
                            if (displayNames != null && displayNames.size() > 0) {
                                return displayNames.get(0).getDisplayName();
                            }

                            return o.getPortletName();
                        }
                    });

            contexts.add(applicationDefninition);
        }

        contexts.sort(
                new ComparableExtractingComparator<PortletApplicationDefinition, String>(
                        String.CASE_INSENSITIVE_ORDER) {
                    @Override
                    protected String getComparable(PortletApplicationDefinition o) {
                        final String portletContextName = o.getName();
                        if (portletContextName != null) {
                            return portletContextName;
                        }

                        final String applicationName = o.getContextPath();
                        if ("/".equals(applicationName)) {
                            return "ROOT";
                        }

                        if (applicationName.startsWith("/")) {
                            return applicationName.substring(1);
                        }

                        return applicationName;
                    }
                });
        return contexts;
    }
public List < PortletApplicationDefinition > getPortletApplications ( ) { final PortletRegistryService portletRegistryService = portalDriverContainerServices . getPortletRegistryService ( ) ; final List < PortletApplicationDefinition > contexts = new ArrayList < > ( ) ; for ( final Iterator < String > iter = portletRegistryService . getRegisteredPortletApplicationNames ( ) ; iter . hasNext ( ) ; ) { final String applicationName = iter . next ( ) ; final PortletApplicationDefinition applicationDefninition ; try { applicationDefninition = portletRegistryService . getPortletApplication ( applicationName ) ; } catch ( PortletContainerException e ) { throw new RuntimeException ( "Failed to load PortletApplicationDefinition for '" + applicationName + "'" ) ; } final List < ? extends PortletDefinition > portlets = applicationDefninition . getPortlets ( ) ; portlets . sort ( new ComparableExtractingComparator < PortletDefinition , String > ( String . CASE_INSENSITIVE_ORDER ) { @ Override protected String getComparable ( PortletDefinition o ) { final List < ? extends DisplayName > displayNames = o . getDisplayNames ( ) ; if ( displayNames != null && displayNames . size ( ) > 0 ) { return displayNames . get ( 0 ) . getDisplayName ( ) ; } return o . getPortletName ( ) ; } } ) ; contexts . add ( applicationDefninition ) ; } contexts . sort ( new ComparableExtractingComparator < PortletApplicationDefinition , String > ( String . CASE_INSENSITIVE_ORDER ) { @ Override protected String getComparable ( PortletApplicationDefinition o ) { final String portletContextName = o . getName ( ) ; if ( portletContextName != null ) { return portletContextName ; } final String applicationName = o . getContextPath ( ) ; if ( "/" . equals ( applicationName ) ) { return "ROOT" ; } if ( applicationName . startsWith ( "/" ) ) { return applicationName . substring ( 1 ) ; } return applicationName ; } } ) ; return contexts ; }
Retreive the list of portlet application contexts currently available in this portlet
container.

@return list of portlet context