[opencms-dev] multi-site static export

Dave Clark daveclark at utah.gov
Sat Apr 27 00:53:50 CEST 2013


Is it possible to use opencms as a content management system for multiple
completely static sites? We are running v8.5.1 in Tomcat7 as the root
context.  All content from multiple sites is static and should be exported
(i.e., not ever served directly from opencms except by the 404 handler when
appropriate). There is a web server in front of tomcat that maps root
directories to /path/to/site1 and /path/to/site2 respectively and forwards
404 errors to the opencms handler.  However, even if I call the 404 handler
directly using http://site1:8080/opencms/handle404?exporturi=/index.html or
http://site2:8081/opencms/handle404?exporturi=/sites/2/index.html, the
files in site2 always get written as /path/to/site2/sites/2/[filename] and
the links inside that file include the /sites/2/[filename]  in the href
which makes the url http://site2:8081/sites/2/[filename]

The site1 files seem to behave correctly. Is there a configuration element
that isn't being set that could be causing this?  The two folders
(/sites/default and /sites/2) cannot have the same exportname property "/"
so I can't see how this would ever work.  The document at
http://www.algoa.ch/opencms/export/sites/default/alkacon-documentation/documentation_staticexport/advanced/tutorial.html
seems
to indicate this is possible but I just can't make it work.

Below is a snippet of opencms-importexport.xml:

  <staticexport enabled="true">

<staticexporthandler>org.opencms.staticexport.CmsOnDemandStaticExportHandler</staticexporthandler>

<linksubstitutionhandler>org.opencms.staticexport.CmsDefaultLinkSubstitutionHandler</linksubstitutionhandler>
    <exportpath>/path/to/site1</exportpath>
    <exportworkpath>temp</exportworkpath>
    <exportbackups>2</exportbackups>
    <defaultpropertyvalue>true</defaultpropertyvalue>
    <defaultsuffixes>
      <suffix key=".jpg"/>
      <suffix key=".gif"/>
      <suffix key=".png"/>
      <suffix key=".doc"/>
      <suffix key=".xls"/>
      <suffix key=".ppt"/>
      <suffix key=".pdf"/>
      <suffix key=".txt"/>
      <suffix key=".css"/>
      <suffix key=".zip"/>
      <suffix key=".swf"/>
    </defaultsuffixes>
    <rendersettings>
      <rfs-prefix></rfs-prefix>
      <vfs-prefix>${SERVLET_NAME}</vfs-prefix>
      <vfs-prefix>${SERVLET_NAME}</vfs-prefix>-->
      <userelativelinks>true</userelativelinks>
      <exporturl>http://site1:8080${SERVLET_NAME}/handle404</exporturl>
      <plainoptimization>true</plainoptimization>
      <testresource uri="/system/shared/page.dtd"/>
      <resourcestorender>
        <regex>/sites/.*</regex>
        <regex>/system/workplace/commons/style/.*</regex>
        <regex>/system/galleries/.*</regex>
        <regex>/system/modules/.*/resources/.*</regex>
      </resourcestorender>
      <rfs-rules>
        <rfs-rule>
          <name>site2</name>
          <description>site2 rfs location</description>
          <source>/sites/2/.*</source>
          <rfs-prefix></rfs-prefix>
          <exportpath>/path/to/site2</exportpath>
          <userelativelinks>false</userelativelinks>
          <related-system-res/>
        </rfs-rule>
      </rfs-rules>
    </rendersettings>
  </staticexport>

I have also changed the above so that /sites/default (site1) has its own
rfs-rule but the result is the same. Here is the site config from
opencms-system.xml:

        <sites>
            <workplace-server>http://site1:8080</workplace-server>
            <default-uri>/sites/default/</default-uri>
            <site server="http://site1:8080" uri="/sites/default/"/>
            <site server="http://site2:8081" uri="/sites/hmis/"/>
        </sites>

-- 
Dave Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130426/eb1fb6c9/attachment.htm>


More information about the opencms-dev mailing list