You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jabbar Azam <aj...@gmail.com> on 2005/09/29 17:00:37 UTC

Tapestry 4 portlet inside liferay 3.6.1

Hello,
Has anybody got a tapestry 4 beta 8 portlet to run inside liferay
3.6.1 running in jboss 4.0.2 and mysql 4.x. OS is windows 2000
Mine initially runs but on clicking a link in the portlet I get "An
exception has occured. Click here to continue. Your session has
expired."
In the server.log file I don't see anything unusual.

My files are,


web.xml
------------
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.4//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>sitelistportlet</display-name>
  <!-- required for web app -->
  <!--
  <filter>
    <filter-name>redirect</filter-name>
    <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
  </filter>
  -->
  <!-- required for web app -->
  <!--
  <filter-mapping>
    <filter-name>redirect</filter-name>
    <url-pattern>/</url-pattern>
  </filter-mapping>
  -->
  <servlet>
    <servlet-name>sitelistportlet</servlet-name>
    <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>sitelistportlet</servlet-name>
    <url-pattern>/app</url-pattern>
  </servlet-mapping>

  <session-config>
    <session-timeout>15</session-timeout>
  </session-config>

</web-app>


hivemodule.xml

--------------------------
<?xml version="1.0" encoding="UTF-8"?>

<module id="sitelist" version="1.0.0"
package="com.technolog.page.sitelist"> id="sitelist" version="1.0.0"
package="com.technolog.page.sitelist">



<contribution

configuration-id="tapestry.portlet.resolver.PageResolverRules">configuration-id="tapestry.portlet.resolver.PageResolverRules">

<match portlet-mode="view" page="Home"/>

</contribution><match portlet-mode="view" page="Home"/>

</contribution>



</module>
home.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
      PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
      "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
      <page-specification class="com.technolog.portlet.page.sitelist.Home">
          <component id="table" type="contrib:Table">
              <binding name="source" value="siteListModel"/>
              <binding name="columns" value="literal:id, sitename:siteName"/>
          </component>
          <property name="count" initial-value="0" persist="session"/>
      </page-specification>


Home.page
----------------
<?xml version="1.0"?>
<!DOCTYPE application PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">

<application name="SiteList">
      <library id="contrib"
specification-path="/org/apache/tapestry/contrib/Contrib.library"/>
</application>

Home.java
--------------

package com.technolog.portlet.page.sitelist;

import org.apache.tapestry.html.BasePage;

import com.technolog.portlet.model.sitelist.SiteListModel;

public abstract class Home extends BasePage{

    public abstract String getCount();
    public abstract void setCount(String count);
    /**
     *
     * @return
     */
    public SiteListModel getSiteListModel() {
        try {
            System.out.print("getSiteListModel");
        return new SiteListModel();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }

    /**
     *
     *
     */
    public void increaseCount() {
        int count = Integer.parseInt(getCount())+1;
        setCount(String.valueOf(count));
    }
}



SiteListModel.java
--------------------------

package com.technolog.portlet.model.sitelist;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import org.apache.tapestry.contrib.table.model.IBasicTableModel;
import org.apache.tapestry.contrib.table.model.ITableColumn;

import com.technolog.dbobject.Site;

public class SiteListModel implements IBasicTableModel {

    private static List<Site> rows;
    private static int numRows=40;

    static {
        Vector<Site> myRows = new Vector<Site>(0);
        for (int currentRow=0; currentRow<numRows;currentRow++) {
            System.out.println("adding site "+currentRow);
            myRows.add(new Site(new Integer(currentRow), "sitename
"+currentRow));
        }
        rows = myRows;
    }

    /**
     *
     */
    public int getRowCount() {
        System.out.println("called getrows");
        return numRows;
    }
    /**
     *
     */
    public Iterator<Site> getCurrentPageRows(int nFirst, int nPageSize,
            ITableColumn objSortColumn, boolean bSortOrder) {

        int currentRow = nFirst;
        int currentCount=0;
        Vector<Site> pageRows = new Vector<Site>(0);

        while(currentRow<numRows) {
            if ((currentCount>nPageSize)) {
                break;
            }
            pageRows.add(rows.get(currentRow));
            System.out.println("returnung row "+rows.get(currentRow));
            currentCount++;
            currentRow++;
        }

        return pageRows.iterator();
    }

}


portlet.xml

----------------

<portlet-app version="1.0"
  xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
  <portlet>
    <description xml:lang="EN"></description>
    <portlet-name>sitelistportlet</portlet-name>
    <display-name xml:lang="EN">Site List</display-name>
    <portlet-class>org.apache.tapestry.portlet.ApplicationPortlet</portlet-class>
    <expiration-cache>0</expiration-cache>
    <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>view</portlet-mode>
      <portlet-mode>help</portlet-mode>
      <portlet-mode>edit</portlet-mode>
    </supports>
    <supported-locale>en</supported-locale>
    <portlet-info>
      <title>Sitelist portlet</title>
      <short-title>Site List</short-title>
      <keywords></keywords>
    </portlet-info>
  </portlet>
</portlet-app>


sitelistportlet.application
-----------------------------------

<?xml version="1.0"?>
<!DOCTYPE application PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">

<application name="SiteList">
      <library id="contrib"
specification-path="/org/apache/tapestry/contrib/Contrib.library"/>
</application>

--
Jabbar Azam

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org