10 Replies Latest reply on May 10, 2010 7:59 PM by briankous

    RichFaces-JavaScriptConfig for LiferayPortlet

      Hi community,
      I try to use JBoss RichFaces for creating Portlets running on Liferay Portal using JBoss PortletBridge. First attempts (EchoBean) worked very well.
      But when creating bigger examples which use e.q. rich:calendar problems occur because JavaScript files cannot be accessed (java.io.IOException: Could not get Input stream for resource: org/richfaces/renderkit/html/scripts/calendar.js).

      In Reference Documentation (and other examples) scripts will be made available by adding tags to <header-content> of jboss-portlet.xml. This applies to JBoss Portal only, is there a similar procedure for Liferay Portal as well? I studied liferay-portlet-app.dtd but did not find anything approriate...
      Could someone please be so kind to give me an example on how to integrate references to scripts and css files needed by RichFaces?

      Following the reference guide, org.richfaces.LoadStyleStrategy and org.richfaces.LoadScriptStrategy are set to NONE in web.xml, org.ajax4jsf.RESOURCE_URI_PREFIX is set to rfRes and there is an URL Pattern /faces/* defined which mapps to FacesServlet.
      I am using Liferay 5.2.3 running on JBoss 4.2.3.

      Could someone please be so kind to give me an advise?

      Thanks a lot and have a nice day!

      Kind Regards,

      Martin

        • 1. Re: RichFaces-JavaScriptConfig for LiferayPortlet

          oh... parts of my text was not posted... Next try:
          Hi community,
          I try to use JBoss RichFaces for creating Portlets running on Liferay Portal using JBoss PortletBridge. First attempts (EchoBean) worked very well.
          But when creating bigger examples which use e.q. rich:calendar problems occur because JavaScript files cannot be accessed (java.io.IOException: Could not get Input stream for resource: org/richfaces/renderkit/html/scripts/calendar.js).

          In Reference Documentation (and other examples) scripts will be made available by adding tags to <header-content> of jboss-portlet.xml. This applies to JBoss Portal only, is there a similar procedure for Liferay Portal as well? I studied liferay-portlet-app.dtd but did not find anything approriate...
          Could someone please be so kind to give me an example on how to integrate references to scripts and css files needed by RichFaces?

          Following the reference guide, org.richfaces.LoadStyleStrategy and org.richfaces.LoadScriptStrategy are set to NONE in web.xml, org.ajax4jsf.RESOURCE_URI_PREFIX is set to rfRes and there is an URL Pattern /faces/* defined which mapps to FacesServlet.
          I am using Liferay 5.2.3 running on JBoss 4.2.3.

          Could someone please be so kind to give me an advise?

          Thanks a lot and have a nice day!

          Kind Regards,

          Martin

          • 2. Re: RichFaces-JavaScriptConfig for LiferayPortlet

            sorry guys but there were some tags which avoids my post from being displayed correctly:

            Hi community,
            I try to use JBoss RichFaces for creating Portlets running on Liferay Portal using JBoss PortletBridge. First attempts (EchoBean) worked very well.
            But when creating bigger examples which use e.q. rich:calendar problems occur because JavaScript files cannot be accessed (java.io.IOException: Could not get Input stream for resource: org/richfaces/renderkit/html/scripts/calendar.js).

            In Reference Documentation (and other examples) scripts will be made available by adding

            <script>
            tags to
            <header-content>
            of jboss-portlet.xml. This applies to JBoss Portal only, is there a similar procedure for Liferay Portal as well? I studied liferay-portlet-app.dtd but did not find anything approriate...
            Could someone please be so kind to give me an example on how to integrate references to scripts and css files needed by RichFaces?

            Following the reference guide, org.richfaces.LoadStyleStrategy and org.richfaces.LoadScriptStrategy are set to NONE in web.xml, org.ajax4jsf.RESOURCE_URI_PREFIX is set to rfRes and there is an URL Pattern /faces/* defined which mapps to FacesServlet.
            I am using Liferay 5.2.3 running on JBoss 4.2.3.

            Could someone please be so kind to give me an advise?

            Thanks a lot and have a nice day!

            Kind Regards,

            Martin

            • 3. Re: RichFaces-JavaScriptConfig for LiferayPortlet

              one remark to add...

              I tried to add

              <header-portal-javascript>/faces/rfRes/org/ajax4jsf/framework.pack.js</header-portal-javascript>
              to liferay-portal.xml portlet definition: Tags will be inserted in source code but requests to scripts are not successful...

              definition inserted in portals header:
              <script src="/faces/rfRes/org/richfaces/renderkit/html/scripts/calendar.js?browserId=firefox&minifierType=js&t=1251818068509"></script>


              exception stays the same: java.io.IOException: Could not get Input stream for resource: org/richfaces/renderkit/html/scripts/calendar.js

              Thanks a lot for your help.

              Yours,

              Martin

              • 4. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                 

                "pd_monshausen" wrote:
                one remark to add...

                I tried to add
                <header-portal-javascript>/faces/rfRes/org/ajax4jsf/framework.pack.js</header-portal-javascript>
                to liferay-portal.xml portlet definition: Tags will be inserted in source code but requests to scripts are not successful...


                Try to add your faces portlet mapping extension to your file path.

                For example, if your mapping is :

                <servlet-mapping>
                 <servlet-name>Faces Servlet</servlet-name>
                 <url-pattern>*.jsf</url-pattern>
                </servlet-mapping>
                


                Your header-portal-javascript should be like that :

                <header-portal-javascript>/faces/rfRes/org/ajax4jsf/framework.pack.js.jsf</header-portal-javascript>


                Hope it helps.



                • 5. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                  After posting my last remark I wondered about "browserId=firefox&minifierType=js&t=1251818068509"" being inserted after my defined scripts url.
                  I have now checked that liferay adds additional filters to web.xml automatically. Those filters are used to compress css files and other resources.
                  I not commented out those filters and now it works as expected. I am just trying to check-out which of the filters could be applied again in order to use compression and caching of Liferay...

                  • 6. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                    Thanks Pouet for your help.
                    Does this also helps to avoid the problems mentioned in my last post? That liferays filters try to access css and js files before servlet mapping could resolve paths?
                    Thanks,

                    Martin

                    • 7. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                      As long as the extension you're using isn't in Liferay filters, it should indeed avoid this problem.

                      • 8. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                        By the way, you can check if your resource url is good by simple trying to access it in your browser.
                        Example with *.jsf url pattern : [yourServerAdress]/[portletname]/faces/rfRes/org/ajax4jsf/framework.pack.js.jsf

                        If you can't get to your js file that way, then something is wrong in your mapping or your url doesn't match your mapping.

                        • 9. Re: RichFaces-JavaScriptConfig for LiferayPortlet

                          Thank you very much Pouet!!!
                          You are right, using a different extension will solve my problem.
                          Thanks and have a nice day!
                          Yours,

                          Martin

                          • 10. Re: RichFaces-JavaScriptConfig for LiferayPortlet
                            briankous

                            Martin,

                             

                            How was your experience with Liferay 5.2.3 running on JBoss 4.2.3?  I want to run Liferay 6.0.1 on JBoss 6.0.1. However our infrastructure guys want Jboss 4.2.3 as we already have clustered environment of Jboss 4.2.3 in production. I could not find anything about 6.0.1 so I am looking at Liferay 5.2.3 running on JBoss 4.2.3 as an alternative. Any information, especially link to installation instruction will be great. Thank you.

                             

                            Brian Ko