Search the FirstSpirit Knowledge Base
Hi,
After I've published a page with a picture I would like to request in java the url of that page/picture. I have seen some examples with PathLookup in FS 5.
Here we still use 4.2.489. Does anyone know how I can solve this within this version?
Thank you.
Hi
an url is created during the generation. So you can get the url in FirstSpirit 4.2R4 only during the generation.
The easiest way is to create a page which references all the needed PageRefs and stores their urls in xml for example.
But if it is important to get the urls in Java-code, you could use a script in the template by using CMS_RENDER. This script will run in the GenerationScriptContext which enables you to get the UrlCreatorProvider used by the ContentProducer#getUrl(...) method.
Regards
Rouven
Hi,
The UrlCreator I have seen now. But I have a challenge as I call a workflow from data sources in Java and then a schedule entry for generation. So we need to find out how we can reach the GenerationScriptContext in this context instead of the WorkflowScriptContext.
Thank you.
Hi
int the ScheduleContext the UrlCreator is stored in a property. This property is only set if a generate task was performed before the script-execution.
Afterwards you can receive the UrlCreator with this code: (source: https://community.e-spirit.com/message/11438#11438 )
context.getProperty(GenerateTaskExecutor.CONTEXT_KEY_URLCREATOR);
Regards
Rouven
Thanks, I will try this :smileygrin: