Olaf Kock 5 Years Ago I *love* when someone from the development team writes about their achievements and changes - this one is particularly valuable - Thank you Pavel. I can't go without saying that a few words on https://docs.liferay.com/ce/apps/web-experience/latest/javadocs/com/liferay/journal/model/JournalArticleModel.html#getContent-- would help tremendously as well ;) Is it ok for Javadoc to link to blog articles? This would be a prime case for exactly that: give some "implementation dependent" content warning there and link to this article for the details and steps to solve the problem. Thank you for providing the detailed steps. Please sign in to reply. Reply as... Cancel
Christoph Rabel 5 Years Ago In my opinion the flaw is in the design. We developers should actually never care about the internal data storage. We shouldn't even "know" that the webcontent is stored as xml. But we need it. First, when we import content. It is not uncommon and I had to do it several times. Import some content from somewhere and store it as webcontent. In that case, we needed to create the xml "manually". Not too hard, but why do I have to know the internal representation of the data? Secondly in ADTs: The tags to render webcontent with a given template were introduced only last year (if I recall correctly). We have several old templates that use the "parse xml" approach, but in some cases it was also the easiest approach to just parse the xml (instead of rendering the content). There are several usecases, where rendering the content just doesn't cut it. To give an example: In a webcontent template you just get the fields in the current language. You just can't access fields in other languages. Third, trough /api/jsonws. Reading the content gives us the xml. Well, IMHO that rest api is IMHO quite broken anyway and really hard/impossible to use except for the most basic usecases. If you really want to fix it: Please introduce a nice "data transfer object" (dto) for webcontent. You already do that to some degree with fields (in the webcontent itself, forgot the class name). We developers should only use said DTO to create/read/update webcontent. That would actually help all of us. You will be free to do whatever you want internally. And we will have a nice object to work with instead of fiddling with the xml content ... Please sign in to reply. Reply as... Cancel Krzysztof Gołębiowski Christoph Rabel 5 Years Ago I strongly support this idea, we should not be aware of what is the internal article storage mechanism. As Christoph mentioned, there could be an API that allows a developer (both java and freemarker) to manipulate the article contents. It would be also very helpful if the API would allow to explicitly control how the domain:port/context URLs are generated within the rendered article, without having to deal with Request and Response objects (however the base method that includes Request and Response should remain in place as it is still used in most cases). Please sign in to reply. Reply as... Cancel
Krzysztof Gołębiowski Christoph Rabel 5 Years Ago I strongly support this idea, we should not be aware of what is the internal article storage mechanism. As Christoph mentioned, there could be an API that allows a developer (both java and freemarker) to manipulate the article contents. It would be also very helpful if the API would allow to explicitly control how the domain:port/context URLs are generated within the rendered article, without having to deal with Request and Response objects (however the base method that includes Request and Response should remain in place as it is still used in most cases). Please sign in to reply. Reply as... Cancel
George Oakley 5 Years Ago At this moment default json api has no resource path too. I have just one question: is this the same reason for no resource addresses in json service response (available on /api/jsonws)? Sorry but in this form, default json api is not useful for sharing content e.g. for mobile. Please sign in to reply. Reply as... Cancel
Fady Hakim 5 Years Ago Thanks for the article. how to do that with velocity? I have an asset publisher ADT that I want to move it to 7.1. I use to write: #set ($banner_image_val = $banner_image.selectSingleNode($root_element).getStringValue()) and I get the URL for the image. now I get: {"groupId":"20126","name":"DXP.jpeg","alt":"","title":"DXP.jpeg","type":"document","uuid":"313d1448-fcb0-1735-03c9-795ae17d8331","fileEntryId":"48416","resourcePrimKey":"48566"} Please sign in to reply. Reply as... Cancel
Erik Andersson 5 Years Ago Here is a snippet to get the url in a Freemarker ADT: https://bitbucket.org/snippets/mrg3kko/pebq6x/liferay-71-adt-get-download-url-for-a Please sign in to reply. Reply as... Cancel Erik Andersson Erik Andersson 5 Years Ago https://bitbucket.org/snippets/mrg3kko/pebq6x/liferay-71-adt-get-download-url-for-a Please sign in to reply. Reply as... Cancel Jonathan HELL Erik Andersson 3 Years Ago - Edited Dear Erik, Thank you so much for this snippet. Coming from 6.2 to 7.3 hit me hard. I couldn't find any example like that in the LifeRay documentation for days. I owe you a beer. For those who are struggling like me, do not forget to remove the serviceLocator from the restricted variables in Control Panel > Configuration > System settings > Platform > Template Engine Please sign in to reply. Reply as... Cancel
Erik Andersson Erik Andersson 5 Years Ago https://bitbucket.org/snippets/mrg3kko/pebq6x/liferay-71-adt-get-download-url-for-a Please sign in to reply. Reply as... Cancel Jonathan HELL Erik Andersson 3 Years Ago - Edited Dear Erik, Thank you so much for this snippet. Coming from 6.2 to 7.3 hit me hard. I couldn't find any example like that in the LifeRay documentation for days. I owe you a beer. For those who are struggling like me, do not forget to remove the serviceLocator from the restricted variables in Control Panel > Configuration > System settings > Platform > Template Engine Please sign in to reply. Reply as... Cancel
Jonathan HELL Erik Andersson 3 Years Ago - Edited Dear Erik, Thank you so much for this snippet. Coming from 6.2 to 7.3 hit me hard. I couldn't find any example like that in the LifeRay documentation for days. I owe you a beer. For those who are struggling like me, do not forget to remove the serviceLocator from the restricted variables in Control Panel > Configuration > System settings > Platform > Template Engine Please sign in to reply. Reply as... Cancel
Allen Ziegenfus 5 Years Ago I guess this also has to do with why when using document-library fields in freemarker, that .data no longer returns the URL? .getData() does, but unfortunately we are using the .data syntax which used to work before Please sign in to reply. Reply as... Cancel
Alberto de Francisco Martín 4 Years Ago - Edited Great! It took a few hours analyzing what was the best way to replace this part. Thanks Pavel for the solution and for the information provided about the change. Some of us have encountered these types of problems in upgrade 6.2 > 7.2 I think that what Olaf says about inform in javadoc is a very good idea. Please sign in to reply. Reply as... Cancel