Forum Stats

  • 3,854,115 Users
  • 2,264,321 Discussions
  • 7,905,568 Comments

Discussions

Better way or alternative to renderResponse.createActionURL()??

648328
648328 Member Posts: 53
edited Jul 18, 2008 1:21PM in WebLogic Portal
In a Java class I am trying to display content from a node given it's path... the catch is that it can be different types so we are using createActionURL from the renderResponse object... The issue is that depending on the portlet we are calling it from (some jsr168, some not) renderReponse is not available... Is there an alternative or better way to do this in JAVA?

##Current Code##
PortletURL contentUrl = renderResponse.createActionURL();
contentUrl.setParameter("ACTION", "displayContent");
contentUrl.setParameter("path", getNodePath(node.getProperty("contentPath").getValue().getStringValue().replaceAll("\\\\","/")) );
contentUrl.setParameter("displayImage", "true");
url = contentUrl.toString();

Comments

  • 648328
    648328 Member Posts: 53
    Let me ask it a different way... If I have the repository path how can I create a URL to get to the content without createActionUrl
  • 650850
    650850 Member Posts: 843
    Unfortunately, there is no easy solution to your problem, as the URL object you should be using depends on the underlying portlet technology used (JSR168 or not). For JSR168 portlets, the PortletURL code you included should be used. For non-JSR168 portlets, the URL tag libraries or PostbackURL objects should be used.

    In WLP, you may be able to use PostbackURL objects in a JSR168 portlet, but there are known issues where you may lose portlet state by doing this, so it is not recommended.

    Kevin
  • 648328
    648328 Member Posts: 53
    thanks Kevin, I'll take a look at these...
This discussion has been closed.