You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by ma...@schrick-design.de on 2008/05/16 18:00:58 UTC

URL-(re)mapping to document (Lenya 2.0)

Hello Lenya devs,

since some hours I try to achieve the following:
In a Lenya 2.0 publication I'va a document with this url (example): /default/authoring/channel1/tutorial/DG3.html.
Now, any URL which starts with "/default/authoring/channel1/tutorial/DG3/" should call the document mentioned above with a parameter containing the rest of the calling url (whatever comes after .../DG3/).
This "URL-mapping" must not be a client-side redirect.

My thought was to handle this in the publication sitemap.xmap with this pipeline-fragment:
<map:pipelines>
  <map:pipeline>
    <map:match pattern="*/channel1/tutorial/DG3/**">
      <map:redirect-to uri="cocoon:/{1}/channel1/tutorial/DG3.html?x4u={2}"/>
    </map:match>
  </map:pipeline>
 :
 :

but I only get an error (extract from the stacktrace):
java.text.ParseException: Unparseable date: "" ....
Caused by: org.apache.cocoon.sitemap.PatternException: Cannot get variable '' in expression '{date-iso8601-rfc822:{page-envelope:document-lastmodified}}' 

When I'm calling the document itself (/default/authoring/channel1/tutorial/DG3.html) it displays correctly without any errors.

I also tried this in the main sitemap.xmap and in global-sitemap.xmap as well as with different forms of the urls... now I've no more ideas how I should do it...

Maybe is there a way to handle this by a doctype/module?


Any hint is much appreciated.
 Gerd


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: URL-(re)mapping to document (Lenya 2.0)

Posted by Andreas Hartmann <an...@apache.org>.
Hi Gerd,

mail@schrick-design.de schrieb:
> Hello Lenya devs,
> 
> since some hours I try to achieve the following: In a Lenya 2.0
> publication I'va a document with this url (example):
> /default/authoring/channel1/tutorial/DG3.html. Now, any URL which
> starts with "/default/authoring/channel1/tutorial/DG3/" should call
> the document mentioned above with a parameter containing the rest of
> the calling url (whatever comes after .../DG3/).  This "URL-mapping"
> must not be a client-side redirect.

I'm afraid that a client-side redirect is the only option here, since 
otherwise many facilities (more specifically, all that rely on the page 
envelope) won't work.


> My thought was to handle this in the publication sitemap.xmap with
> this pipeline-fragment: <map:pipelines> <map:pipeline> <map:match
> pattern="*/channel1/tutorial/DG3/**"> <map:redirect-to
> uri="cocoon:/{1}/channel1/tutorial/DG3.html?x4u={2}"/> </map:match> 
> </map:pipeline> : :
> 
> but I only get an error (extract from the stacktrace): 
> java.text.ParseException: Unparseable date: "" .... Caused by:
> org.apache.cocoon.sitemap.PatternException: Cannot get variable '' in
> expression
> '{date-iso8601-rfc822:{page-envelope:document-lastmodified}}'

I guess this is caused by the following entry in the publication sitemap:

         <map:act type="language-exists">
           <map:act type="set-header">
             <map:parameter name="Last-Modified" 
value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
           </map:act>
         </map:act>

I'm a little suprised, though, because the language-exists action should 
prevent the snippet from being called since the document 
/channel1/tutorial/DG3/foo doesn't exist. Would you mind checking your 
publication sitemap if such a pipeline is called without the 
language-exists check?


> When I'm calling the document itself
> (/default/authoring/channel1/tutorial/DG3.html) it displays correctly
> without any errors.
> 
> I also tried this in the main sitemap.xmap and in global-sitemap.xmap
> as well as with different forms of the urls...

If you put the pipeline in one of the global sitemaps (which is 
discouraged), it has to look like this:

   <map:match pattern="*/*/channel1/tutorial/DG3/**">

because the URL still contains the publication ID and the area.

> now I've no more ideas how I should do it...
> 
> Maybe is there a way to handle this by a doctype/module?

If you add a lenya.module=... request parameter, you can handle these 
URLs in a module.

If this doesn't help, would it be possible for you to provide access to 
a test environment?

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org