Foros de discusión

AssetPublisher URL Not Working Cross-Site

thumbnail
Ken Driscoll, modificado hace 10 años.

AssetPublisher URL Not Working Cross-Site

Junior Member Mensajes: 57 Fecha de incorporación: 2/07/12 Mensajes recientes
I'm currently developing in Liferay 6.2 GA1, and I believe I've run across a bug that may need to be addressed. I want to make sure that this is not the expected behavior though first.

I have been creating custom Freemarker Display Templates to be used in Asset Publishers. I used the "Rich Summary" display template as a guide, and had copied line for line the following code to create the clickable URL to take the user to a page where the full web content can be viewed:

<#assign assetRenderer = entry.getAssetRenderer() />

<#assign entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />

<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) />

<#if assetLinkBehavior != "showFullContent">
        <#assign viewURL = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL) />
<!--#if-->


This creates the proper URL for the asset, assuming that the asset is located on the same site as the page that contains the Asset Publisher.

Here is the issue:

Liferay's example "Rich Summary" Display Template does not create the correct URL if the content is located on a different site. It instead displays the following error: "The asset could not be found.".

If I use any other display template (such as "Table", "Title List" or "Abstracts"), the URL is created correctly. When I compare the two urls, the incorrect URL is missing the web content's Site ID, which is why it can't locate it.


Has anyone else noticed this behavior, or am I doing something wrong? Since Liferay's own display templates create two different URLs, I would assume that this is a Liferay bug, but I just want to make sure this isn't user error on my part.
Thanks in advance!
thumbnail
Eduardo P. García, modificado hace 3 años.

RE: AssetPublisher URL Not Working Cross-Site

Regular Member Mensajes: 157 Fecha de incorporación: 16/03/12 Mensajes recientes
Hi Ken,

Thanks for finding and reporting this issue. We have already solved it. Take a look at LPS-43681.

Regards