Super easy guide: inject your portlets wherever you want!

eXo Platform Blog

With our extension mechanism, we can now package and deploy new features easily in eXo Platform 4 as add-ons. You can deploy your own portlets but also existing ones, ready to use and ready to be deployed, with the add-ons manager:


Platform 4.1 has a new way to inject your portlets easily into pre-established places within the platform. It’s easy and we have covered most of the places you will need. Of course, the feature is extensible, which means you can define new places and then inject your portlets wherever you want

Let’s say you want to inject your new add-on into the Platform to add a simple new application on the top right of your Home:


Most of the changes are going to be made within your WAR file in the file /webapp/WEB-INF/conf/portlet/dynamic-container-configuration.xml.

This file is imported into configuration.xml within the WAR. The goal is to redefine a configuration file from the WAR without overriding the previous one present with the exact same location and name in your Platform. (documentation).


		<description>add application Config</description>

			<!-- You must define here the portlet Name -->
				<description>sample hello portlet</description>
				<object type="org.exoplatform.commons.addons.PortletModel">
					<field name="contentId">
					<!-- In the container definition within your jar you have added a new container : sampleDynamicContainer
					This container will contain the targeted portlet helloPortlet. -->
					<!--The following values are optionals-->

This file declares the new add-on but also the container name where you want to inject it.

Your JAR should contain your backend and the portal container configuration in file /src/main/resources/conf/configuration.xml.


<!-- The full qualified name of the PortalContainerConfig —>     
	<!-- The name of the plugin -->
		<name>Add PortalContainer Definitions</name>
		<!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
		<!-- The full qualified name of the PortalContainerDefinitionChangePlugin -->
				<object type="org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependencies">
				<!-- The list of name of the dependencies to add -->
					<field name="dependencies">
						<collection type="java.util.ArrayList">

In this file we are updating the portlet configuration from the PortalContainerConfig to register the new sampleDynamicContainer in the PortalContainerDefinitions.


That’s just an example for a social intranet. With the new dynamic container we have provided, you are going to be able to inject your portlets more easily and safely.

You will find this example of packaging on the eXo Samples Repository. In the meantime, if you want to try ready-to-use add-ons for your Platform, check out the add-ons repository and of course you can submit your add-ons to the community!

Join the eXo tribe by registering for the community and get updates, tutorials, support, and access to the Platform and add-on downloads!

Make the most out of eXo Platform 4

Register to the next webinar and get a complete overview of what you can do with eXo Platform 4. Reserve your seat now!

Related Posts
Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>