2 Replies Latest reply on Sep 17, 2009 8:20 AM by pouet

    Liferay Richfaces portlet with portlet bridge 2.0.0.ALPHA pe

      Hi community,
      I've recently started working on the development of Spring-Richfaces portlets for Liferay (5.2.3) using JBoss Portlet Bridge 2.0.0.ALPHA.

      I managed to make the whole thing work fine with simple pages until I started to create more complex pages.
      Rich and ajax4jsf components are working as intended, but I am facing heavy performance problems due to resource loading.
      In fact, Richfaces js / css resources are reloaded every time the rendering of a component needs them.

      For example, a page with a datatable + datascroller + 1 context menu + 1 modalpanel with content re rendered using ajax is generating :
      - 20+ GET requests for resources on load.
      - 4 GET requests for resources for a click on a row showing a context menu
      - 25+ GET requests for resources when the modal panel is called (which takes more than 3 seconds to load)

      I tried all these parameters combinations for resource loading :
      org.richfaces.LoadStyleStrategy / org.richfaces.LoadScriptStrategy to NONE, ALL, DEFAULT with org.ajax4jsf.COMPRESS_SCRIPT true and false

      All these parameters don't seem to have any impact on resource loading, it looks like they're simply ignored (is this bug back in 2.0 ALPHA ?! => https://jira.jboss.org/jira/browse/PBR-63).

      Then I tried to load the packed resources in the portlet header (liferay-header.xml) like in the referenced guide : the resources are resolved, loaded in the header, but since the loading strategies are ignored (I think this solution is intended to work with loading strategies to NONE), the problem remains (ie : resources reloaded each time no matter what).

      I also tried to use the PortalResourceBuilder extension, it didn't work as well, the builder couldn't resolve any resource (NPE thrown on every attempt to load anything).

      I'm now out of solution so I'm here seeking for help :

      - Did anyone have the same problem (on Liferay or not) ?
      - Am I doing something wrong ?
      - Is it a bug of PB 2 Alpha ?

      Here's my web.xml / faces-config.xml if it can help :

      Web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
       <display-name>moduleclient</display-name>
      
       <!-- Spring config -->
       <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/config/application-config.xml</param-value>
       </context-param>
       <!-- Spring config -->
       <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
       </listener>
      
      
       <context-param>
       <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
       <param-value>true</param-value>
      
       </context-param>
       <context-param>
       <param-name>javax.portlet.faces.renderPolicy</param-name>
       <param-value>ALWAYS_DELEGATE</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>org.jboss.portletbridge.application.FaceletPortletViewHandler</param-value>
       </context-param>
      
      
       <context-param>
       <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
       <param-value>rfRes</param-value>
       </context-param>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.jspx</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>0</param-value>
       </context-param>
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>false</param-value>
       </context-param>
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.richfaces.LoadStyleStrategy</param-name>
       <param-value>NONE</param-value>
       </context-param>
       <context-param>
       <param-name>org.richfaces.LoadScriptStrategy</param-name>
       <param-value>NONE</param-value>
       </context-param>
      
      <!-- <context-param>
       <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
       <param-value>true</param-value>
       </context-param> -->
      
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.cache.LRU_MAP_CACHE_SIZE</param-name>
       <param-value>2048</param-value>
       </context-param>
      
      
       <filter>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
       <init-param>
       <param-name>createTempFiles</param-name>
       <param-value>false</param-value>
       </init-param>
       <init-param>
       <param-name>maxRequestSize</param-name>
       <param-value>100000</param-value>
       </init-param>
       </filter>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       <dispatcher>ERROR</dispatcher>
       </filter-mapping>
      
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
      
       <!-- Automatically added by Liferay -->
       <servlet>
       <servlet-name>moduleclient</servlet-name>
       <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
       <init-param>
       <param-name>portlet-class</param-name>
       <param-value>javax.portlet.faces.GenericFacesPortlet</param-value>
       </init-param>
       <load-on-startup>0</load-on-startup>
       </servlet>
      
       <!-- Automatically added by Liferay -->
       <servlet-mapping>
       <servlet-name>moduleclient</servlet-name>
       <url-pattern>/moduleclient/*</url-pattern>
       </servlet-mapping>
      
      </web-app>
      


      faces-config.xml
      <?xml version="1.0" encoding="UTF-8"?>
      
      <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
       <application>
       <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
       <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
       <locale-config>
       <default-locale>en_US</default-locale>
       <supported-locale>en_US</supported-locale>
       </locale-config>
       <el-resolver>com.acp.portlet.common.ui.utils.MessageSourceELResolver</el-resolver>
       </application>
       <factory/>
       <navigation-rule>
      ....
       </navigation-rule>
      </faces-config>
      


      Thanks in advance for any help provided,
      Regards