A fairly new standard InfoGlue is supporting is the Portlet standard also known as JSR 168. Since InfoGlue 2.0 InfoGlue has incorporated Apache Pluto which is the reference implementation of the portlet API. Portlets are covered on the Internet extensively why we will not leave a lot of room here.
We will state however that for an organisation that has competence in such development this option is probably one of the best integration options as it will allow you to build a completely decoupled web application but seamlessly integrate it in an InfoGlue page and having interaction etc. taken care of. In a later section we will show you how to build a simple portlet and deploy it in InfoGlue. Then you will have to read more on the subject yourself.
This section will guide you through creating a simple Hello World portlet and deploying it in InfoGlue 2.3. It will not show you how to build portlets with more sophisticated frameworks like Struts or Webwork as that is not a question for InfoGlue.
Step 1 – Create a Hello World Portlet.
Create a new Java project called HelloPortlet in your favourite development environment.
Create a file called org/infoglue/portlets/HelloPortlet.java and fill it with this:
The file needs portlet-api-1.0.jar in its class path to compile. Get it from tomcat/shared/lib if InfoGlue is installed, from the Pluto distributions or from any other official site.
Next we create a portlet.xml:
Next we create a web.xml for this portlet:
Step 2 – Package the portlet as a WAR-file.
I just create a war-file with the following contents.
That is it really.
You can download the example war from http://www.infoglue.org/downloads.
Step 3 – Deploy the portlet in InfoGlue.
Now we deploy the portlet in InfoGlue. Open up the management tool and press the ”New Portlet”-button. Then state HelloPortlet and browse to the war-file. Finish by pressing ”Save”.
The result should be that the new portlet is listed.
Step 4 – Use the portlet on a page though a component.
Before you can use the new portlet often you have to restart tomcat after this stage. Also remove the deployed war-file from the catalina webapps directory as the webapp should now unpacked and the war is just interfering. Do this before you continue.
Create a component/template with the following code:
Now just add this component to a page and you should see ”Hello World” in large letters.
This was the crash course to creating your very first portlet. Now you probably have to read a portlet-book to know what to do next.