Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 536.4K On-Premises Infrastructure
- 138.3K Analytics Software
- 38.6K Application Development Software
- 5.8K Cloud Platform
- 109.5K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.3K Integration
- 41.6K Security Software
Better way or alternative to renderResponse.createActionURL()??

648328
Member Posts: 53
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();
##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
-
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
-
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 -
thanks Kevin, I'll take a look at these...
This discussion has been closed.