2 Replies Latest reply on Nov 19, 2008 9:28 PM by johnnythehun

    Portal 2.7.0 - how to get to PortalNode API?

    johnnythehun

      I am using 2.7.0 RC1

      I would like to:

      A) Create a navigational portlet (2.7.0 RC1 had none) that can display the page tree of a specific portal

      B) I would like to create pages programmaticly.


      My first problem is: I am unable to get to the PortalNode API from a portlet.
      - I cannot cast to RenderRequest to JBossRenderRequest
      - If my portlet extends JBossPortlet I get an Exception "The request isn't a JBossRenderRequest" telling me to use a JBoss Porlet Filter for every portlet that extends JBossPortlet.

      Where should I look for the solution? Is there any way I can access a PortalNode so I can traverse the nodes?

      tabs.jsp uses:
      PortalNode root = (PortalNode)request.getAttribute("org.jboss.portal.api.PORTAL_NODE");
      but I have no such thing in the request.

      Thanks in advance,
      John

        • 1. Re: Portal 2.7.0 - how to get to PortalNode API?
          prabhat.jha

          - Please use 2.7.0.GA version instead of RC1.

          - You need to add JBoss Portlet Fileter as mentioned in reference guide at http://docs.jboss.com/jbportal/v2.7.0/referenceGuide/html/changelog.html

          • 2. Re: Portal 2.7.0 - how to get to PortalNode API?
            johnnythehun

            Thanks it works.

            For the Page creation part - if anyone else is looking for a solution I found this on another thread (it works):

            TransactionManager tm = null;
             try {
             InitialContext ic = new InitialContext();
             tm = (TransactionManager) ic.lookup("java:/TransactionManager");
             return tm;
             } catch (NamingException ex) {
             System.out.println("Failed to find transactionmnager");
             return null;
             }
            try {
            tm.begin();
            MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
             container = (PortalObjectContainer) MBeanProxy.get(PortalObjectContainer.class, new ObjectName("portal:container=PortalObject"), mbeanServer);
             Context ctx = container.getContext();
            
             Portal po = ctx.getPortal(pathToPage.get(0).getName());
            
             po.createPage("JBOSS rocks!");
            } finally {
            tm.commit();
            }