[opencms-dev] Export Document

Claus Priisholm cpr at codedroids.com
Wed Sep 10 13:31:01 CEST 2003


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




More information about the opencms-dev mailing list