论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Simon Haidenbauer
Link to asset publisher from custom portlet
2013年9月24日 上午2:58
答复

Simon Haidenbauer

等级: New Member

帖子: 6

加入日期: 2011年4月7日

最近的帖子

Hello,

I'm looking for a way to generate a link to an asset publisher from my custom portlet. The asset publisher shall display a journal article. I have the articleId/assetId in my portlet but can't find a way to generate a correct link. If it's possible the link should be a friendlyURL and should work from the same page and from a completely different page.
I've googled and searched for a solution in this forum but either it's too easy or no one else has tried this before (though I can't quite believe that).
I'd greatly appreciate help on this,

kind regards,
Simon
Jose Jimenez
RE: Link to asset publisher from custom portlet
2013年9月24日 上午3:38
答复

Jose Jimenez

LIFERAY STAFF

等级: Regular Member

帖子: 151

加入日期: 2012年8月22日

最近的帖子

Hi Simon,

You can use the deffined friendlyURLs for the Asset Publisher, take a look about supported format & params:

https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portlet/assetpublisher/asset-publisher-friendly-url-routes.xml


Regards,
Jose
Juan Gonzalez
RE: Link to asset publisher from custom portlet
2013年9月24日 上午4:14
答复

Juan Gonzalez

LIFERAY STAFF

等级: Liferay Legend

帖子: 2947

加入日期: 2008年10月28日

最近的帖子

In addition to what Jose said, here is a method used for that purpose (6.1.2 GA3). You just have to get the article by its id:

https://github.com/liferay/liferay-portal/blob/6.1.2-ga3/portal-impl/src/com/liferay/portlet/journal/asset/JournalArticleAssetRenderer.java#L171

Probably you won't need all that lines of code.
Simon Haidenbauer
RE: Link to asset publisher from custom portlet
2013年9月24日 上午6:20
答复

Simon Haidenbauer

等级: New Member

帖子: 6

加入日期: 2011年4月7日

最近的帖子

Thank you both,
I've already found a solution by setting the display page of the article(s) and using

1assetRenderer.getURLViewInContext(liferayPortletRequest, liferayPortletResponse, PortalUtil.getCurrentURL(request))


That way I get the correct URL to display the article in the default asset publisher of the page.
Jose Jimenez
RE: Link to asset publisher from custom portlet
2013年9月24日 下午12:58
答复

Jose Jimenez

LIFERAY STAFF

等级: Regular Member

帖子: 151

加入日期: 2012年8月22日

最近的帖子

Nice, this is a good option.

Jose