Fórumok

Journal Article access inconsistency

Mike Perico, módosítva 11 év-val korábban

Journal Article access inconsistency

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2012.08.23. Legújabb bejegyzések
I am having two issues in my CMS velocity template running in 6.1.2 EE.

1. Neither one of the code samples below are displaying retrieving my article. I can see in the database table JournalArticle that there is row with groupId set to 10826.

2. I have noticed that I get inconsistent results with the code below. The first returns null and the second returns an empty XML result. I don't understand why this is? They both have the same URL except that the first uses the @portal_url@ tokens and the other gets the server name from the "request" object. I am printing out the URL for both and they look exact, but I am getting different results. This is making my debugging much harder.

Any help?

#set( $url1 = "http://@portal_url@@main_path@/journal/get_articles?groupId=10826")
URL1 = $url1 <br>
#set ($document1 = $saxReaderUtil.readURL($url1))
<textarea style="height: 100px; width: 275px;">
The resulting XML is: $document1.asXML()
</textarea>
<hr>

#set( $url2 = "http://$request.theme-display.portal-url$request.theme-display.path-main/journal/get_articles?groupId=10826")
URL2 = $url2 <br>
#set( $document2 = $saxReaderUtil.readURL($url2))
<textarea style="height: 100px; width: 275px;">
The resulting XML is: $document2.asXML()
</textarea>
<hr>
Gwowen Fu, módosítva 11 év-val korábban

RE: Journal Article access inconsistency

Expert Bejegyzések: 315 Csatlakozás dátuma: 2010.12.27. Legújabb bejegyzések
I think you will need to specify Article ID instead of groupId.
Mike Perico, módosítva 11 év-val korábban

RE: Journal Article access inconsistency

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2012.08.23. Legújabb bejegyzések
I believe I have found the reason for the first issue, but I it appears as a liferay bug.

If I put the URL:
http:/myserver.com/c/journal/get_articles?groupId=10826&delta=1

in a browser that also has liferay in a tab that is logged in, I get back XML data as expected. If I open another browser that isn't logged into liferay. I get empty set XML. If I then log into the liferay in that browser and refresh I get XML data.

So it appears that when I am using it in a portlet where I am logged I get back empty XML. That tells me that the session (for some reason) doesn't realize that I am "logged in". I am not sure how to fix this as it appears to either be a velocity or liferay bug.

Can liferay staff confirm this?