Skip to main content
Open PortalPortlet Container Project
Community
Contribute
Contribute
Download Portlet Container
Download!

This section describes how to install Portlet Container 2.x.  Its recommeded that you uninstall the existing version of Portlet Container before installing a new version. 

The Portlet Container can be installed on the following webcontainers. For other containers, you need to install manually.
  1. Download the Portlet Container 2.x binary.

  2. Install Portlet Container 2.x from the GUI or from the command line.

    • From the GUI:

      a. Type:

      % java -jar portlet-container-configurator.jar

      Note: If you installed the Web Container as root on UNIX, execute the command lines as root.

      The installer is displayed. See Figure 1.

      Installer for Portlet Container
      Figure 1: Installer for Configuring Portlet Container 2.x
       
      b. Choose the Web Container from the Select Container drop-down menu and fill in the text fields with the appropriate information. Click OK.

    • From the command line:

      Type:

      % java -jar portlet-container-configurator.jar <WebContainer-install-dir> <domain-dir/webapps-dir>  <Container>   <ANT_HOME>

      where WebContainer-install-dir is the location in which you installed the WebContainer and GlassFish-domain-dir is GlassFish's domain directory.
      where domain-dir is GlassFish's domain directory and webapps-dir  is Tomcat and Jetty's webapps directory
      where Container can be one of glassfish, tomcat, tomcat6, jetty, weblogic. If not present glassfish is assumed.
      where ANT_HOME points to the ANT installation directory. Instead the environment variable ANT_HOME can also be provided

      For example:

      • On Windows, type:

        java -jar portlet-container-configurator.jar c:\glassfish c:\glassfish\domains\domain1
        or
        java -jar portlet-container-configurator.jar c:\tomcat c:\tomcat\webapps tomcat6 c:\ant-1.7.1

      • On UNIX, type:

        java -jar portlet-container-configurator.jar /usr/local/glassfish /usr/local/glassfish/domains/domain1
        or
        java -jar portlet-container-configurator.jar /usr/local/tomcat /usr/local/tomcat/webapps tomcat6 /usr/local/ant

Afterward, do the following:

  1. Restart the Web container.

  2. Deploy and test the portlets: Go to http://hostname:portnumber/portletdriver, for example, http://localhost:8080/portletdriver.

    The Portlet Container Driver page is displayed along with two tabs at the top (see Figure 2):

    • Portlets, which you click to display portlets

    • Admin, which you click to deploy or undeploy the portlet application (see Figure 3)
       
      Portlet Container Driver
      Figure 2: Portlet Container Driver Page
       
      Portlet Container Admin1
      Portlet Container Admin2
      Figure 3: Screen for Deploying Or Undeploying Portlets

Portlet Deployment and Undeployment

This section explains how to deploy a portlet, how to undeploy it

Deploying Portlets

You can deploy portlets in one of three ways:

  • From the GUI — On the Portlet Container Driver page, click the Admin tab. Under Deploy a Portlet, in the Select Portal War File text field, type the path name of the portlet in and click Deploy. By default a Portlet Window is created and is displayed when the Portlets tab is clicked. But if you do not want the Portlet Window to be displayed, then you need to check the box ""Hide Portlet Window" before deploying the portlet. Later you can show the Portlet Window. See below for more details.

  • On the command line — Type:

    % cd <portlet-container-home>/bin

    % ant deploy-portlet -Dportlet-war=portlet-WAR-filename.war

    Example: % ant deploy-portlet -Dportlet-war=HelloWorldPortlet.war

  • With autodeploy — Copy the portlet's Web archive (WAR) file to the <portlet-container-home>/autodeploy directory. After deploying the application, Portlet Container 2.x creates a file named portlet-WAR-filename.deployed in that directory.

Afterward, Portlet Container 2.x creates a portlet window with a thick width. Click the Portlets tab to display the portlet content in the window. Figure 4 is an example.

  • Portlet Window
    Figure 4: Example of Portlet Window
 

The window contains icons that support the portlet modes (View, Edit, and Help) and the window states (Maximize and Minimize).

Undeploying Portlets

You can undeploy portlets in one of three ways:

  • From the GUI — On the Portlet Container Driver page, click the Admin tab, select one or more portlets from the scrolling list under Undeploy Portlets, and click Undeploy.

  • On the command line — Type:

    % cd <portlet-container-home>/bin 

    % ant undeploy-portlet -Dportlet-war=portlet-WAR-filename

    Example: % ant undeploy-portlet -Dportlet-war=HelloWorldPortlet

  • With autodeploy — Delete the portlet's WAR file from the GlassFish-install-dir/domains/domain1/portlet-container/autodeploy directory. After undeploying the application, Portlet Container 2.x deletes the file portlet-WAR-filename.deployed from that directory.

Afterward, Portlet Container 2.x deletes all the windows associated with the portlets and undeploys the portlet application from the application server, such as GlassFish.

Creating Multiple Portlet Windows

Multiple portlet windows can be created based on the same portlet. The Portlet Preferences are stored per user and per portlet window.

To create a window for a portlet and set the related preferences:

  1. Click the Admin tab.

  2. Under Create a Portlet Window, select a portlet from the Select Base Portlet scrolling list and type the appropriate information in the Portlet Window Name and Portlet Title text fields.

    Afterward, Portlet Container 2.x creates a portlet window with a thin width. Click the Portlets tab to display the portlet content in the window.

Repeat steps 1 and 2 for additional windows.

Modifying Portlet Windows

You can modify the visibility(show/hide) and width(thin/thick) of the portlet window.

To modify the visibility(show/hide) and width(thin/thick) of the portlet window.

  1. Click the Admin tab.

  2. Under Modify Portlet Window, select a portlet from the Select Base Portlet Window scrolling list. The current visibility status and width for the portlet window is displayed. After changing the values, Click on Modify to have the new values in effect.

Authentication

FORM-based authentication is used to authenticate the user.  Log in by clicking Sign In at the top.
In case of GlassFish, you can login using the GlassFish administrator, admin
In case of Tomcat,  you can login using the Tomcat administrator, tomcat

Uninstallation

This section describes how to uninstall previous versions of Portlet Container.

On GlassFish:
    Enter the following command in <GlassFish-domain-dir>

% ant -f <portlet-container-home>/setup.xml uninstall-pc

On Tomcat:
    Enter the following command in <Tomcat-install-dir>

% ant -f <portlet-container-home>/setup.xml uninstall-pc-on-tomcat

On WebLogic:
    Enter the following command in <WebLogic-domain-dir>

% ant -f <portlet-container-home>/setup.xml uninstall-pc-on-weblogic

On Jetty:
    Enter the following command in <Jetty-install-dir>

% ant -f <portlet-container-home>/setup.xml uninstall-pc-on-jetty

On JBoss:
    Enter the following command in <JBoss-server-dir>

% ant -f <portlet-container-home>/setup.xml uninstall-pc-on-jboss

Storing Portlet Driver Data in the database

By default the Portlet Driver data required to display the portlets like portlet window information, portlet preferences are stored in files. But this can be changed to store the information in the database.  The can be done as follows
  1. Open the file  <portlet-container-home>/config/DriverConfig.properties and set the property persistenceType=database. (default value is file)
  2. As the persistence provider used is Oracle Toplink, you need Toplink Essentials. In case of Tomcat and Jetty, you need to copy toplink-essentials.jar to <server-install-dir>/lib. In case of GlassFish and WebLogic this jar is part of the installation.
  3. If the database
  1. is Derby, you need to copy derby.jar to <server-install-dir>/lib 
  2. is Hypersonic you need to copy hsql.jar to <server-install-dir>/lib
  3. is MySQL: you need to copy mysql.jar to <server-install-dir>/lib 
  • You need to provide the database connection details. Open the file  <portlet-container-home>/config/DriverConfig.properties
    1. If the database is Derby,  uncomment the properties mentioned below "For Derby"  and provide the jdbc url, driver, user and password
    2. If the database is Hypersonic,  uncomment the properties mentioned below "For HSQL"  and provide the jdbc url, driver, user and password
    3. If the database is MySQL,  uncomment the properties mentioned below "For MySQL"  and provide the jdbc url, driver, user and password

    Including the portlet in the webapp

    Following are the steps to include the portlet in the JSP(eg: portlet.jsp)
    1. Include <portlet-container-home>/lib/portletdriver.jar in the WEB-INF/lib of your webapplication
    2. Add the PortletDriverFilter configuration to your web.xml
          <filter>
              <filter-name>portletDriverFilter</filter-name>
              <filter-class>com.sun.portal.portletcontainer.driver.PortletDriverFilter</filter-class>
          </filter>
          <filter-mapping>
              <filter-name>portletDriverFilter</filter-name>
              <url-pattern>/portlet.jsp</url-pattern>
          </filter-mapping>
    3. Include the portlet in your jsp(i.e portlet.jsp in this example)
      <%@taglib uri="http://portlet-container.dev.java.net" prefix="pcdriver"%>

      <pcdriver:portlet portletName="WelcomePortlet" applicationName="WelcomePortlet" >
           <h2 class="portlet-title"><pcdriver:title/></h2>
           <pcdriver:render/>
       </pcdriver:portlet>

    Note:

    Portlet Container Home:
    GlassFish: <portlet-container-home> is GlassFish-install-dir/domains/domain1/portlet-container
    Tomcat: <portlet-container-home> is Tomcat-install-dir/portlet-container
    WebLogic: <portlet-container-home> is WebLogic-domain-dir/portlet-container
    Jetty: <portlet-container-home> is Jetty-install-dir/portlet-container
    JBoss: <portlet-container-home> is JBoss-server-home/portlet-container


    HOME

     
     
    Close
    loading
    Please Confirm
    Close