Uploaded image for project: 'Extended Templating Kit (closed)'
  1. Extended Templating Kit (closed)
  2. MGNLETK-27

Multi site support and virtualURIMappings don't play nice together: can not resolve site definition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.3.1
    • 1.3
    • None

      This only happens when you are browning your site on the admin server, and have the site name in the url (no host mapping)

      for instance: I have this page: http://localhost:8080/festival/event.html?name=Kasabian
      on the public instance this page would get an ulr like this: festivalsite.vpro.nl/event.html?name=Kasabian
      But our editors will see the site through the (production version of the) first link

      the site root node name is 'festival' and the site def node name is 'festivalsites'

      I create links to this page 'manually' , and i ran into the problem that I would have to know if the site name should be part of the url or not.
      so i first obtain the content node of the site, and then use LinkUtil.createAbsoluteLink(siteNode) to create a valid link to the site root. then i add /the part to the event page.

      My first surprise was that if you open the site from the admin central, the site name is used, like localhost:8080/festival, but the LinkUtil (used by all stk teasers) appends the site definition name in stead. But both seem to work, so OK.
      so far so good.

      But we also want to use virtalURIMappings, to create nice urls to this page (and page caching), like:
      festivalsite.vpro.nl/event/Kasabian.html

      so i created the virtualURIMapping, and it works well on url's without the sitename. It also works well on url's with the site name, like:
      http://localhost:8080/festival/event/Kasabian.html

      But, alas, the url i got from LinkUtil, doesn't have the site node name, but the site definition node name, so the url becomes:
      http://localhost:8080/festivalsites/event/Kasabian.html

      which throws an error:
      get(cssFiles) failed on instance of info.magnolia.module.templatingkit.style.ThemeReference
      The problematic instruction:
      ----------
      ==> list model.site.theme.cssFiles as cssFile [on line 18, column 1 in templating-kit/templates/global/htmlHeader.ftl]
      in include def.htmlHeader.template [on line 8, column 4 in templating-kit/templates/main.ftl]

      here is an xml dump from my virtualURIMapping configuration:

      <?xml version="1.0" encoding="UTF-8"?>
      <sv:node sv:name="events" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>mgnl:contentNode</sv:value>
      </sv:property>
      <sv:property sv:name="jcr:uuid" sv:type="String">
      <sv:value>2e197e62-7451-4caf-bfe4-77248a7091f2</sv:value>
      </sv:property>
      <sv:property sv:name="class" sv:type="String">
      <sv:value>info.magnolia.cms.beans.config.RegexpVirtualURIMapping</sv:value>
      </sv:property>
      <sv:property sv:name="fromURI" sv:type="String">
      <sv:value>(.*)/event/([\w-]+)\.html</sv:value>
      </sv:property>
      <sv:property sv:name="toURI" sv:type="String">
      <sv:value>forward:$1/event.html?name=$2</sv:value>
      </sv:property>
      <sv:node sv:name="MetaData">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>mgnl:metaData</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:Data" sv:type="String">
      <sv:value>MetaData</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:activated" sv:type="Boolean">
      <sv:value>false</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:authorid" sv:type="String">
      <sv:value>superuser</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:creationdate" sv:type="String">
      <sv:value>2004-11-02T15:34:20.479+01:00</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
      <sv:value>2010-05-12T14:44:23.929+02:00</sv:value>
      </sv:property>
      </sv:node>
      </sv:node>

      For some reason the site definition and the related style can not be resolved. (don't know why)

      by the way, http://localhost:8080/festivalsites/event.html?name=Kasabian works equally wel as http://localhost:8080/festival/event.html?name=Kasabian

        Acceptance criteria

              had Jan Haderka
              ebunders Ernst Bunders
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: