[jboss-user] [JBoss Portal] - Re: portal help urgent

rharari do-not-reply at jboss.com
Tue May 29 03:19:25 EDT 2007


Hi Shailesh,

You can harcode a link to "/portal/yourpage" or walk into the portal hierarchy to find your pages.
Follows an example how to do that:


  | import org.jboss.portal.api.node.PortalNode;
  | import org.jboss.portal.api.node.PortalNodeURL;
  | import org.jboss.portlet.JBossRenderRequest;
  | import org.jboss.portlet.JBossRenderResponse;
  | import org.jboss.portal.core.impl.api.node.PortalNodeImpl;
  | 
  | ....
  | 
  | protected void doView(RenderRequest request, RenderResponse response) throws PortletException, UnavailableException {
  | ....
  | 
  |        String myPageName = "MyPageName"; // this is your page name that you´re looking for
  |        JBossRenderRequest req = (JBossRenderRequest) request;
  |        PortalNode currentNode = req.getPortalNode();
  |        while (currentNode.getType() != PortalNode.TYPE_PORTAL) {
  |     	   currentNode = currentNode.getParent();
  |        }
  |        for (Iterator i = currentNode.getChildren().iterator(); i.hasNext();) {
  |           PortalNode child = (PortalNode)i.next();
  |           if (child.getType() == PortalNode.TYPE_PAGE) {
  |         	  if (child instanceof PortalNodeImpl) {
  |         		  if (child.getName().equals(myPageName)) {
  |         			  PortalNodeURL childURL = ((JBossRenderResponse)response).createRenderURL(child);
  |         			  System.out.println("url to mypage = " + childURL.toString());
  |         			  break;
  |         		  }
  |         	  }
  |           }
  |        }
  | 
  | 

There is a good example with the source code. 
Check out this portlet:
core\src\main\org\jboss\portal\core\portlet\catalog\CatalogPortlet.java

You can also verify if the user is allowed to access it before redirect.

Hope this help.

regards,

R.Harari

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049203#4049203

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049203




More information about the jboss-user mailing list