4 Replies Latest reply on Apr 30, 2008 11:30 AM by Sohil Shah

    Access CMS trought a Portlet

    Didier Jeugmans Newbie


      All is in the title, I want to access the JBoss Portal CMS through a portlet but I don't know how. Can you please tell me how can I proced to do what I want. I run on JBossPortal 2.6.4 GA on Windows Vista.


        • 1. Re: Access CMS trought a Portlet
          Peter Johnson Master

          To access a file named mydir/myfile.xxx stored in CMS, you can use this URL:


          Be aware that accessing an HTML file causes the Portal to redirect to the home page (page where the CMS Portlet is located). For all other file types, the file is passed back as-is, making it ideal for things such as displaying images or providing links to download documents.

          • 2. Re: Access CMS trought a Portlet
            Didier Jeugmans Newbie

            Thanks for your answer but, I don't want to access the CMS by a URL I want to explore the content of the CMS by programmation with a portlet that I develop myself.

            • 3. Re: Access CMS trought a Portlet
              Didier Jeugmans Newbie

              I found how to proceed to access the CMS by a programatic way but i had to look in source of JBoss Portal... I don't found any documentation about that.
              Here is my solution if that can help somebody:

              CMS CMSService = (CMS)this.getPortletContext().getAttribute("CMS");
              Command listCMD = CMSService.getCommandFactory().createFolderGetListCommand("/");
              Folder mainFolder = (Folder)CMSService.execute(listCMD);
              List l=mainFolder.getFolders();
              Iterator it=l.iterator();



              It's work but there always a litle problem, I must include the jboss-portal.sar\portal-cms.sar\portal-cms-lib to compile my portlet but when I deploy it I must remove that jar to avoid a Class Cast Exeption during the execution (java.lang.ClassCastException org.jboss.portal.cms.impl.jcr.JCRCommandFactory).

              • 4. Re: Access CMS trought a Portlet
                Sohil Shah Master

                Your observation is correct and the behavior is expected.

                As far is deployment goes, you do not need to include the cms library with your application. Its already included with the core jboss-portal.sar file.

                For compile time you obviously need it