Deploying Portlet to Pluto Portal

There are 2 steps involved in deploying a portlet application in Pluto 1.1:

  • Assembly: All portlet applications must be run through the pluto assembler before being deployed. The assembly process injects pluto specific information for deployment. Specifically, a servlet and servlet mapping are added to the deployment descriptor (web.xml). This servlet (org.apache.pluto.core.PortletServlet will be used to dispatch portlet requests to the portlet application.
  • Deployment: After portlet applications are assembled properly they must be deployed to the servlet engine within which the portal application is running. The current bundled distribution uses Tomcat 5.5 as the servlet engine.

Portlet Assembly

The maven-pluto-plugin can be used to assemble a portlet application war. It will place the proper PortletServlet configuration in web.xml.

The custom Maven 2 build shown below requires a Tomcat context deployment descriptor that has the same name as your artifactId with an xml extension (e.g. HelloWorldPortlet.xml).

To properly assemble your portlet using the Maven 2 plugin, your project's directory structure and artifact placement must conform to Maven's standard:

	HelloWorldPortlet (top level directory)
	|- pom.xml (the pom file)
	|- src (Subdir containing main subdirectory)
	    |- main (Subdir containing java, resources and webapp subdirs)
	    	|- java (java source code goes under here)
		    |       `- com
		    |           `- mycompany
		    |               `- portlet
		    |                   `- (portlet source)
		    |- webapp  (webapp resources (jsp, css, images) go under here)
		    	`- jsp 
		    		`- HelloWorldPortletView.jsp (for view mode)		    			    
		    		`- HelloWorldPortletEdit.jsp (for edit mode)		    			    
		    	`- META-INF
		    		`- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
		    	`- WEB-INF
			    	`- portlet.xml (JSR-168 deployment descriptor)
			    	`- web.xml (This will be modified by maven-pluto-plugin)

This is an example of what the Tomcat context deployment descriptor will contain:

		<Context path="/HelloWorldPortlet"

To configure the maven-pluto-plugin, you must configure it in your pom. For easy of setup, use this as you pom file, changing the groupId, artifactId and version to values appropriate to your custom portlet.

<project xmlns=""
  <!-- Change this to something akin to your java package structure -->
  <!-- Version of this app -->
  <!-- Base name of the war file without .war ext -->
  <!-- Dependency Version Properties ======================================= -->
      <scope>provided</scope><!-- Prevents addition to war file -->
    <!-- Any other build or deployment dependancies go here -->
      <!-- configure to use Java 6 to compile (change to your JDK) --> 
      <!-- configure maven-war-plugin to use updated web.xml -->
      <!-- bind 'pluto:assemble' goal to 'generate-resources' lifecycle -->

Once configured, the war generated by an 'mvn package' (or install) command will contain the appropriate pluto configuration.

Portlet Deployment

To deploy a portlet application, simply deploy the application war using any standard mechanism for your application server. There are many maven plugins and ant tasks that can assist with this, or you can use an administrative web console. This console is the Tomcat manager webapp in the Pluto bundled distribution and is accessed via the 'Upload and deploy portlet war' link on the page administration portlet. See the Help link on that portlet for more details.

In the bundled distribution that uses Tomcat, deployment of an assembled war can simply be done by dropping the war into the webapps directory. You can automatically achive this by adding the following code within the plugins section of your maven pom.xml:

                  <property environment="env"/>
                   <!-- This assumes that you have set a CATALINA_HOME environmental variable -->
                  <property name="pluto.home" value="${env.CATALINA_HOME}"/>
                  <copy file="target/${}.war" todir="${pluto.home}/webapps"/>

Once the pom.xml file has been updated with this plugin, you can run the full build and deployment using the command: mvn integration-test. The code assumes that you have set the environmental variable CATALINA_HOME to the Pluto home directory. If that has not been done, just set pluto.home from the command line with the -D flag. The command line would then be: mvn -Dpluto.home=C:/pluto integration-test.

Portlet Publishing

As soon as the portlet application (war) is deployed to the servlet container the portlet application will be available to the portal and can be added to pages using the page administration portlet. See the help mode in this portlet for details on its use.

Portal Page Configuration

If you'd like for your page configuration to be consistent throughout restarts of the application server (currently placements made through the page administration portlet is not persistent), you should then configure the page layout in the portal-driver configuration file (pluto-portal-driver-config.xml).

The page can then be configured by adding a page child element of the render-config element, like this:

<render-config default="Test Page">
  ... ...
  <page name="Your Portal Page Name" uri="/WEB-INF/fragments/portlet.jsp">
    <portlet context="/your_portlet_app_context_path"
    <portlet context="/your_portlet_app_context_path"

The uri attribute defines the theme of your portal page. If you use /WEB-INF/fragments/portlet.jsp (which is the default theme of Pluto Testsuite portlet app), your portlets will be displayed in two columns. You can clone this file to customize your layout. If you do so, make sure the uri attribute points to the new file.