What Is a Portlet
Deploying HelloWorld Portlet on Pluto
Pluto is in the early stages of development, so it does not have a set of easy-to-use administrative tools. In order to use the Pluto server, you will have to download both the binary and source versions. Please note that these instructions are for Windows; Unix users can get similar results by changing slashes and using .sh shell scripts rather than .bat batch files.
- Create a folder, such as C:\PlutoInstallation.
- Download pluto-1.0.1-rc1.zip and pluto-src-1.0.1-rc1.zip from the Pluto website.
- Extract pluto-1.0.1-rc1.zip into C:\PlutoInstallation. It should get extracted in C:\PlutoInstallation\pluto-1.0.1-rc1.
- Start Pluto by calling C:\PlutoInstallation\pluto-1.0.1-rc1\bin\startup.bat.
You are ready to access your Pluto server at http://localhost:8080/pluto/portal.
- Extract pluto-src-1.0.1-rc1.zip to C:\PlutoInstallation\PlutoSrc.
- Go to C:\PlutoInstallation\PlutoSrc and run
maven distribute:all.. This should build and download necessary dependencies required for running common admin tasks.
Now it is time to install our HelloWorldPortlet.war as a portlet.
- First, copy HelloWorldPortlet.war to the C:\PlutoInstallation\portlets directory, creating the directory if necessary.
- Rename C:\PlutoInstallation\plutosrc\build.properties.sample to build.properties.
- Open build.properties and change it so that
maven.tomcat.home points to the Pluto binary installation. In our example, this will be maven.tomcat.home=C:/PlutoInstallation/pluto-1.0.1-rc1.
- To install your portlet, go to C:\plutoInstallation\plutosrc\deploy and run
maven deploy -Ddeploy=c:\PlutoInstallation\portlets\HelloWorldPortlet.war. You should get a "build successful" message.
- In C:\PlutoInstallation\pluto-1.0.1-rc1\webapps, you should see a folder for HelloWorldPortlet.
- Now, open the web.xml file of your installed portlet by going to the C:\PlutoInstallation\pluto-1.0.1-rc1\webapps\HelloWorld\WEB-INF\ folder. You will see that a few lines are automatically added to this file, like this:
<servlet>
<servlet-name>HelloWorld</servlet-name>
<display-name>HelloWorld Wrapper</display-name>
<description>Automated generated
Portlet Wrapper</description>
<servlet-class>org.apache.pluto.core.PortletServlet
</servlet-class>
<init-param>
<param-name>portlet-class</param-name>
<param-value>com.test.HelloWorld
</param-value>
</init-param>
<init-param>
<param-name>portlet-guid</param-name>
<param-value>HelloPluto.HelloWorld
</param-value>
</init-param>
</servlet>
- Now it's time for us to add this portlet to the page. Go to C:\PlutoInstallation\pluto-1.0.1-rc1\webapps\pluto\WEB-INF\data. You will find two XML files there: pageregistry.xml and portletentityregistry.xml.
- portletentityregistry.xml contains the definition of the portlet. Add these lines to it:
<application id="5">
<definition-id>HelloWorld</definition-id>
<portlet id="1">
<definition-id>HelloWorld.HelloWorld</definition-id>
</portlet>
</application>
The <definition-id> of the application should be the name of the web application folder. The portlet's <definition-id> should be equal to the generated portlet-guid in web.xml.
- pageregistry.xml defines which portlets to include on the page. Change it like this:
<fragment name="p2" type="portlet">
<property name="portlet" value="5.1"/>
</fragment>
- Restart the Pluto server by first calling
shutdown and then startup. Now go back to http://localhost:8080/pluto/portal and click on "Test Link"--it should show our HelloWorld portlet.
-
The right side of Figure 3 shows what your HelloWorld portlet will look like.

Figure 3. Screen shot of portlet screen (click for full-size image)
Prev [1] [2] [3] [4] [5] [6] Next