{"id":7518,"date":"2014-09-18T05:55:44","date_gmt":"2014-09-18T12:55:44","guid":{"rendered":"http:\/\/localhost\/exoblog\/?p=7518"},"modified":"2014-09-18T05:55:44","modified_gmt":"2014-09-18T12:55:44","slug":"super-easy-guide-inject-portlets-wherever-want","status":"publish","type":"post","link":"https:\/\/www.exoplatform.com\/blog\/super-easy-guide-inject-portlets-wherever-want\/","title":{"rendered":"Super easy guide: inject your portlets wherever you want!"},"content":{"rendered":"<p>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 <a href=\"https:\/\/www.exoplatform.com\/blog\/2014\/07\/16\/add-ons-manager-1-0-0-rc2\/\">add-ons manager<\/a>:<br \/>\n<!--more--><br \/>\n<a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-7519\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container.jpg\" alt=\"1-dynamic-container\" width=\"650\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container.jpg 996w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-300x158.jpg 300w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-768x406.jpg 768w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-720x380.jpg 720w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-500x264.jpg 500w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-360x190.jpg 360w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-200x106.jpg 200w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-100x53.jpg 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/1-dynamic-container-57x30.jpg 57w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/a><\/p>\n<p>Platform 4.1 has a new way to inject your portlets easily into pre-established places within the platform. It\u2019s 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<\/p>\n<p>Let\u2019s 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:<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-7520\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement.png\" alt=\"2-new-add-on-placement\" width=\"630\" height=\"411\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement.png 630w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-300x196.png 300w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-500x326.png 500w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-360x236.png 360w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-200x131.png 200w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-100x65.png 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/2-new-add-on-placement-46x30.png 46w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Most of the changes are going to be made within your WAR file in the file <span class=\"navCode\">\/webapp\/WEB-INF\/conf\/portlet\/dynamic-container-configuration.xml<\/span>.<\/p>\n<p>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. (<a href=\"http:\/\/docs.jboss.org\/exojcr\/1.16.1-GA\/developer\/en-US\/html\/chapter-eXoJCRWithGateIn.html#JCRWithGateIn.HowToExtendMyGateInInstance.FAQ\" target=\"_blank\" rel=\"noopener\">documentation<\/a>).<\/p>\n<p><span class=\"navCode\" style=\"font-size: 16px;\"><b><a href=\"https:\/\/github.com\/exo-samples\/sample-dynamic-container\/blob\/master\/sample-dynamic-container-webapp\/src\/main\/webapp\/WEB-INF\/conf\/portlet\/dynamic-container-configuration.xml\" target=\"_blank\" rel=\"noopener\">dynamic-container-configuration.xml<\/a><\/b><\/span><\/p>\n<pre class=\"lang:xhtml decode:true\">&lt;external-component-plugins&gt;\n\t&lt;target-component&gt;org.exoplatform.commons.addons.AddOnService&lt;\/target-component&gt;\n\t&lt;component-plugin&gt;\n\t\t&lt;name&gt;addPlugin&lt;\/name&gt;\n\t\t&lt;set-method&gt;addPlugin&lt;\/set-method&gt;\n\t\t&lt;type&gt;org.exoplatform.commons.addons.AddOnPluginImpl&lt;\/type&gt;\n\t\t&lt;description&gt;add application Config&lt;\/description&gt;\n\t\t&lt;init-params&gt;\n\t\t\t&lt;value-param&gt;\n\t\t\t\t&lt;name&gt;priority&lt;\/name&gt;\n\t\t\t\t&lt;value&gt;1&lt;\/value&gt;\n\t\t\t&lt;\/value-param&gt;\n\t\t\t&lt;value-param&gt;\n\t\t\t\t&lt;name&gt;containerName&lt;\/name&gt;\n\t\t\t\t&lt;value&gt;top-application-container&lt;\/value&gt;\n\t\t\t&lt;\/value-param&gt;\n\n\t\t\t&lt;object-param&gt;\n\t\t\t&lt;!-- You must define here the portlet Name --&gt;\n\t\t\t\t&lt;name&gt;helloPortlet&lt;\/name&gt;\n\t\t\t\t&lt;description&gt;sample hello portlet&lt;\/description&gt;\n\t\t\t\t&lt;object type=\"org.exoplatform.commons.addons.PortletModel\"&gt;\n\t\t\t\t\t&lt;field name=\"contentId\"&gt;\n\t\t\t\t\t&lt;!-- In the container definition within your jar you have added a new container : sampleDynamicContainer\n\t\t\t\t\tThis container will contain the targeted portlet helloPortlet. --&gt;\n\t\t\t\t\t\t&lt;string&gt;sampleDynamicContainer\/helloPortlet&lt;\/string&gt;\n\t\t\t\t\t&lt;\/field&gt;\n\t\t\t\t\t&lt;!--The following values are optionals--&gt;\n\t\t\t\t\t...\n\t\t\t\t&lt;\/object&gt;\n\t\t\t&lt;\/object-param&gt;\n\t\t&lt;\/init-params&gt;\n\t&lt;\/component-plugin&gt;\n&lt;\/external-component-plugins&gt;<\/pre>\n<p>This file declares the new add-on but also the container name where you want to inject it.<\/p>\n<p>Your JAR should contain your backend and the portal container configuration in file <span class=\"navCode\">\/src\/main\/resources\/conf\/configuration.xml.<\/span><\/p>\n<p><span class=\"navCode\" style=\"font-size: 16px;\"><b><a href=\"https:\/\/github.com\/exo-samples\/sample-dynamic-container\/blob\/master\/sample-dynamic-container-config\/src\/main\/resources\/conf\/configuration.xml\" target=\"_blank\" rel=\"noopener\">configuration.xml<\/a><\/b><\/span><\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;external-component-plugins&gt;\n&lt;!-- The full qualified name of the PortalContainerConfig \u2014&gt;     \n\t&lt;target-component&gt;org.exoplatform.container.definition.PortalContainerConfig&lt;\/target-component&gt;\n\t&lt;component-plugin&gt;\n\t&lt;!-- The name of the plugin --&gt;\n\t\t&lt;name&gt;Add PortalContainer Definitions&lt;\/name&gt;\n\t\t&lt;!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions --&gt;\n\t\t&lt;set-method&gt;registerChangePlugin&lt;\/set-method&gt;\n\t\t&lt;!-- The full qualified name of the PortalContainerDefinitionChangePlugin --&gt;\n\t\t&lt;type&gt;org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin&lt;\/type&gt;\n\t\t&lt;init-params&gt;\n\t\t\t&lt;values-param&gt;\n\t\t\t\t&lt;name&gt;apply.specific&lt;\/name&gt;\n\t\t\t\t&lt;value&gt;portal&lt;\/value&gt;\n\t\t\t&lt;\/values-param&gt;\n\t\t\t&lt;object-param&gt;\n\t\t\t\t&lt;name&gt;change&lt;\/name&gt;\n\t\t\t\t&lt;object type=\"org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependencies\"&gt;\n\t\t\t\t&lt;!-- The list of name of the dependencies to add --&gt;\n\t\t\t\t\t&lt;field name=\"dependencies\"&gt;\n\t\t\t\t\t\t&lt;collection type=\"java.util.ArrayList\"&gt;\n\t\t\t\t\t\t\t&lt;value&gt;\n\t\t\t\t\t\t\t\t&lt;string&gt;sampleDynamicContainer&lt;\/string&gt;\n\t\t\t\t\t\t\t&lt;\/value&gt;\n\t\t\t\t\t\t&lt;\/collection&gt;\n\t\t\t\t\t&lt;\/field&gt;\n\t\t\t\t&lt;\/object&gt;\n\t\t\t&lt;\/object-param&gt;\n\t\t&lt;\/init-params&gt;\n\t&lt;\/component-plugin&gt;\n&lt;\/external-component-plugins&gt;<\/pre>\n<p>In this file we are updating the portlet configuration from the PortalContainerConfig to register the new sampleDynamicContainer in the PortalContainerDefinitions.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-7521\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed.jpg\" alt=\"3-add-on-deployed\" width=\"608\" height=\"256\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed.jpg 608w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-300x126.jpg 300w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-500x211.jpg 500w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-360x152.jpg 360w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-200x84.jpg 200w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-100x42.jpg 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/09\/3-add-on-deployed-70x30.jpg 70w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/a><\/p>\n<p>That\u2019s 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.<\/p>\n<p>You will find this example of packaging on the <a href=\"https:\/\/github.com\/exo-samples\/sample-dynamic-container\" target=\"_blank\" rel=\"noopener\">eXo Samples Repository<\/a>. In the meantime, if you want to try ready-to-use add-ons for your Platform, check out the <a href=\"https:\/\/github.com\/exo-addons\" target=\"_blank\" rel=\"noopener\">add-ons repository<\/a> and of course you can <a href=\"https:\/\/community.exoplatform.com\/portal\/intranet\/add-ons\" target=\"_blank\" rel=\"noopener\">submit your add-ons to the community<\/a>!<\/p>\n<p><b><a href=\"https:\/\/community.exoplatform.com\/portal\/dw\/\" target=\"_blank\" rel=\"noopener\">Join the eXo tribe<\/a> by registering for the community and get updates, tutorials, support, and access to the Platform and add-on downloads!<\/b><\/p>\n<p><!--begin adv-events--><\/p>\n<div class=\"adv-events\" style=\"background: #476fad; padding: 30px 20px; color: white; border-radius: 3px;\">\n<div class=\"media\">\n<div class=\"pull-right\"><a href=\"#\"><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6587 alignright\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2014\/02\/how-to-make-the-most-of-eXo-platform41.png\" alt=\"make-the-most-out-of-eXo-platform4\" width=\"161\" height=\"85\" \/><br \/>\n<\/a><\/div>\n<div class=\"media-body\">\n<h4 class=\"media-heading\">Make the most out of eXo Platform 4<\/h4>\n<p>Register to the next webinar and get a complete overview of what you can do with eXo Platform 4. <strong><a href=\"https:\/\/www.exoplatform.com\/contact-us\/\">Reserve your seat now!<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!--end adv-events--><\/p>\n","protected":false},"excerpt":{"rendered":"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:","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[699],"tags":[],"lang":"en","translations":{"en":7518},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/7518"}],"collection":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/comments?post=7518"}],"version-history":[{"count":0,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/7518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/media?parent=7518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/categories?post=7518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/tags?post=7518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}