[opencms-dev] Problems and scheduled static export

Niklas Eklund niklas at curalia.se
Thu Jan 8 13:11:01 CET 2004


Nice one! I like it when a dirty hack really works... ;)

Regards,

  Niklas

Jörg Herbst wrote:

> Hi Niklas,
> 
> it seems, as I've solved the problem. You have to install a proper 
> CmsLaunchManager to get a correct export for HTML files.
> 
> I've added the following lines and now the whole thing works fine:
>        String propsPath = CmsBase.getPropertiesPath(true);
>        Configurations conf = new Configurations(new 
> ExtendedProperties(propsPath));
>        cmsForStaticExport.setLauncherManager(new CmsLauncherManager(new 
> OpenCms(conf)));
> 
> I guess, it's a pretty dirty workaround to create a complete new CMS 
> Object, but I haven't found a better way yet.
> 
> Thanks for your help
> Jörg
> 
>> Hi Jörg,
>>
>> I haven't tried this with jsp, only with (customized) xml-templates so 
>> I don't know. Could it be that jsp pages/templates need a proper 
>> CmsLauncherManager? Maybe you also have to set some properties on the 
>> jsp templates to allow export..?
>> One thing to remember is also that all parts of a page must be 
>> published at least once for it to be exported, ie visible (and 
>> working) in the online project.
>>
>> Regards,
>>
>>  Niklas
>>
>> Jörg Herbst wrote:
>>
>>> Hi Niklas,
>>>
>>> thanks a log, your code helped to get the whole thing working at all. 
>>> All files are now exported or skipped as I want to, but there is 
>>> still a problem. All files just contain one single line:
>>> [jsptemplate] ???
>>> Seems as if there is still something missing to get to correct 
>>> templates. I get this error on all exported html Pages.Images and 
>>> other none text resources work fine. Any idea, where I've got to to 
>>> look for the error?
>>>
>>> Greetings
>>> Joerg
>>>
>>>> Hello,
>>>>
>>>> This is two snippets of the hack in the cron job I used to get it 
>>>> working:
>>>>
>>>>         String webappURL = null;
>>>>         String servletURL = null;
>>>>         try {
>>>>             String context = A_OpenCms.getOpenCmsContext();
>>>>             webappURL = context.substring(0, context.indexOf('/', 1));
>>>>             servletURL =
>>>>                 context.endsWith("/")
>>>>                     ? context.substring(0, context.length() - 1)
>>>>                     : context;
>>>>         } catch (RuntimeException e) {
>>>>             return "Context not set up yet, cannot continue";
>>>>         }
>>>>
>>>> ...
>>>> ...
>>>> ...
>>>>
>>>>                 // set up the necessary env
>>>>                 CmsExportRequest dReq =
>>>>                     new CmsExportRequest(webappURL, servletURL);
>>>>                 CmsExportResponse dRes = new CmsExportResponse();
>>>>                 CmsObject cmsForStaticExport =
>>>>                     cms.getCmsObjectForStaticExport(dReq, dRes);
>>>>                 // hmm, seems to work
>>>>                 cmsForStaticExport.setLauncherManager(
>>>>                     new CmsLauncherManager(null));
>>>>
>>>>          
>>>> cms.getRequestContext().setCurrentProject(I_CmsConstants.C_PROJECT_ONLINE_ID); 
>>>>
>>>>
>>>>                 CmsStaticExport staticExport =
>>>>                     new CmsStaticExport(
>>>>                         cmsForStaticExport,
>>>>                         exportResources,
>>>>                         true,
>>>>                         new Vector(),
>>>>                         new Vector(),
>>>>                         null,
>>>>                         new CmsShellReport());
>>>>             }
>>>>
>>>> exportResources is a Vector with the absolute paths (String) to the 
>>>> resources you want to export. You will get a warning/error about 
>>>> something (can't remember about what, but it should work). Good luck!
>>>>
>>>> Regards,
>>>>
>>>>  Niklas
>>>>
>>>> Jörg Herbst wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm trying to implement a scheduled publishing of my project. I've 
>>>>> implemented a I_CmsCronJob Object for calling cms.publishProject. 
>>>>> This works fine and the project is published as I want.
>>>>> My problem is, the static export is not triggered. I guess there is 
>>>>> no RequestContext in CmsStaticExport  [Line 229] 
>>>>> (cms.getRequestContext().getRequest() != null), so the static 
>>>>> export branch is never processed.
>>>>> So I've tried to change the source, removing the if condition. Now 
>>>>> I'm running in problems of a missing Launcher object 
>>>>> (NullPointerException).
>>>>> Has anybody successfully implemented a scheduled publishing 
>>>>> including a static file export yet and can give me some help?
>>>>>
>>>>> Thanks
>>>>> Joerg
>>>>
>>>>
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list