[opencms-dev] Export Document

Ben Rometsch ben at solidstategroup.com
Wed Sep 10 18:40:02 CEST 2003


Thanks for the information.

What I don't understand is that if I browse to 

http://<server IP>:8080/opencms/opencms/<Project name> 

Everything works fine. It's only if I try and run via apache that things go
wrong. I'll try andding the link tag libs and see what happens.

Thanks again,
Ben

-----Original Message-----
From: opencms-dev-admin at opencms.org [mailto:opencms-dev-admin at opencms.org]
On Behalf Of Claus Priisholm
Sent: 11 September 2003 01:55
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] Export Document

I'm not sure exactly what your setup is. As I understand it there are 3
basic scenarios:

1. Run everything dynamically, no export what-so-ever, be that directly
through Tomcat or Tomcat/Apache 2. The default variation where a number of
pages/resources are static and not generated on the fly (still through
Tomcat or the combo) 3. Fully exported, all handled by Apache, no Tomcat
intervention

My example falls into the last category - For that setup OpenCms is 'just'
an editor which eventually dumps the site into an appropriate place such
that Apache or likewise can serve it as any other static HTML site.

I'm not sure exactly when one would be in (1) or (2), at the very least
caching should be used in (1) to speed up the process. Ideally in (2), if
deployed on an Apache/Tomcat combo, Apache should access the files directly
and not by means of the JK plugin. Not sure how that is handled if at all
possible (or maybe it is doing that per default if one maps the export
directory into the document root of the web server), but I expect the prefix
in the opencms.properties file along with Apache rewrites should make it
possible.

As for the JK plugin I ended up using the 'old' version, not the JK2
variant. The latter I couldn't get to work (from following the instructions
on Apache's site), whereas the other one did (I think I know what I did
wrong with JK2 but since the setup with JK works I haven't spent time on
it). A quick look at the example virtual host def you provided it did look
more or less like the one I had, though the first couple of lines seemed
superfluous. I cannot recall the format of the other setup-file, so it could
be there the issue is.

As for the broken images I assume (based on my own mistakes) that you're
missing the <cms:link></cms:link> around the URL in the JSP files. This tag
causes OpenCms to replace the URL with one that works whether the resource
is exported or not. Usually it works without the special tag, but only as
long as they are served from the webapp, it will break as soon as you export
it. Note that URL in the html files (edited by either the source or WYSIWYG
editor automatically gets 'translated' by OpenCms which is nice, since
you're not adding the <cms:link> tag when dropping an image from the
gallery.)

On onsdag, sep 10, 2003, at 15:20 Europe/Copenhagen, Ben Rometsch wrote:

> Hi,
>
> Thanks for the help. It's still quite convoluted IMHO. I'm still 
> unclear what to do about the broken images, and what the best method 
> is to get a JSP
> + static HTML site exported with a Tomcat+Apache setup. Is there no
> documentation for this?
>
> Ben
>
> -----Original Message-----
> From: opencms-dev-admin at opencms.org
> [mailto:opencms-dev-admin at opencms.org]
> On Behalf Of Claus Priisholm
> Sent: 10 September 2003 21:06
> To: opencms-dev at opencms.org
> Cc: cpr at codedroids.dk
> Subject: Re: [opencms-dev] Export Document
>
> Having just done the exercise myself this morning, here's my take on
> it:
>
> The best doc I've found so far is in the opencms.properties file, look 
> for the "staticexport.enabled" entry. It is "true" per default. I 
> haven't tried to check if it only applies to the implicit export which 
> happens when you do a publish or if it also controls the "Static 
> Export" function in the Administration view, but I wanted things to be 
> exported ASAP so I kept it set to "true", in which case a regular 
> publish (direct or entire
> project)
> exports html files as well.
>
> Next one is the "staticexport.default.export" which is "true" by 
> default.
> For my test case this makes sense as it is basically all static. Which 
> means, if the individual files in VFS does not have the "export"
> property
> set then it is assumed to be "true", ie. a file that needs to be 
> exported.
> The test case did include a two-frame html layout, having a menu along 
> the top of the page and the contents below.
> All the contents files are HTML pages in the VFS, the frame file and 
> the menu are both JSPs (though the frame file could probably be a 
> plain HTML as
> well...) The JSP files do, by default, get the "export=false" as a 
> property when created. This of course a reasonable default due to the 
> nature of JSPs and it does work - publish the project and go to the 
> online project and you see the HREFs in the html point to the webapp 
> itself or the export directory, depending on the "export" setting. 
> Works great, but in my case I knew that once generated the menu is 
> static so I made it "export=true", and then I added <cms:link> tags 
> where appropriate in order to get the imagebuttons referenced 
> correctly.
> Publishing/exporting now generates a menu.html in the export directory
> - in my case it means that I have the entire test case site as plain 
> good old HTML files, ready for Apache to serve to the world. I'm not 
> sure if there can be some problems in terms of dependencies in the 
> sense that the now 'static' JSP doesn't get regenerated when some 
> files it depends on gets changed, but so far - doing a static export 
> from the administration menu  - has not caused any problems, it seems 
> to be regenerated upon the export and thus is up to date.
>
> Note the "export" property is not limited to "true" or "false" values.
> There is a number of other legal values, among those "dynamic", but 
> not having fully appreciated what the all the various rulesets in the 
> property file does, I'm not sure if and when it is a better choice 
> than "false".
> Maybe someone on the list can enlighten me...
>
> But a couple of other properties should be set as well. The 
> "staticexport.path" could be set to the document root of the webserver 
> (though keep in mind that the user id which is running the app, ie.
> Tomcat in my case) must have write-permission to the directory. Per 
> default it dumps the exported files into 
> $CATALINA_HOME/webapps/opencms/export. But this only has to do with 
> where the files are dumped, it does not have any implications on the 
> URLs in the html files.
> This is controlled by "url_prefix_export" - the default value 
> "/${WEB_APP_NAME}/export" matches the above export directory such that 
> OpenCms out of the box can make this combined sites, where some pages 
> are static and others dynamic. For my test case, I simply needed to 
> put the exported document tree at the document root of Apache, so I 
> set it to "url_prefix_export=", i.e. empty. But were I to put the 
> exported files in a sub-directory of the web servers document root 
> then the sub-dir name should be the value. Note that once set to 
> something other than the default value, you may not be able to click 
> on the file on the Online project in OpenCms (well, you can click on 
> it, but you not likely to see the file in the
> browser...)
>
> The other prefix settings are more relevant when you're dealing with a 
> more complex setup, ie. before changing the "url_prefix_http" make 
> sure that Apache/Tomcat or whatever knows how to resolve the resulting 
> URL, otherwise you won't be able to log into OpenCms or do anything.
>
> One thing that can be a little confusing when looking at exporting 
> JSPs is the fact that there is another 'export' directory, the 
> $CATALINA_HOME/webapps/opencms/WEB-INF/export. This is because JSP 
> files in VFS is copied to real filesystem in order for Tomcat (or 
> whatever your using to serve JSP/servlets) to actually handle them. 
> But this is implicit export is not to be confused with the "static 
> export".
>
> Hope it helps, writing did at least help me clear up a couple of issue
> :-)
>
> On onsdag, sep 10, 2003, at 09:32 Europe/Copenhagen, Ben Rometsch
> wrote:
>
>> Hi there,
>>
>> I cant find any documentation relating to how static export, JSP's 
>> and publishing all hang together. Am I missing something?
>>
>> Ben
>>
>> _______________________________________________
>> 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
>>
>>
> --
> Claus Priisholm
> +45 48 22 46 46, fax: +45 48 22 46 43
> cpr at codedroids.com
> http://www.codedroids.com
>
> _______________________________________________
> 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
>
> _______________________________________________
> 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
>
>
--
Claus Priisholm
+45 48 22 46 46, fax: +45 48 22 46 43
cpr at codedroids.com
http://www.codedroids.com

_______________________________________________
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