You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Peter Shipley <ps...@nomensa.com> on 2004/07/24 00:22:33 UTC

Replacing client-side redirects with server-side

I am looking into replacing the lenya client side browser redirects 
(META-REFRESH) into server side redirects and just wondered if the 
following is a good way to start.

Any feedback ? The right direction ?

For the create usecase (usecase.xmap) there currently is:

<map:generate type="serverpages" 
src="{fallback:content/util/redirect-document.xsp}">
    <map:parameter name="document-id" 
value="{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}"/>
    <map:parameter name="language" 
value="{request-param:properties.create.language}"/>
</map:generate>
<map:transform src="{fallback:xslt/util/redirect-document.xsl}"/>
<map:serialize/>


I changed this to:

<map:redirect-to 
uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/>


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


Re: Replacing client-side redirects with server-side

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Peter Shipley wrote:

> I am looking into replacing the lenya client side browser redirects 
> (META-REFRESH) into server side redirects and just wondered if the 
> following is a good way to start.
> 
> Any feedback ? The right direction ?
> 
> For the create usecase (usecase.xmap) there currently is:
> 


> <map:redirect-to 
> uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/> 

looks fine to me. can you let us know of test results? if it works, 
there are some other areas, and patches are as always, appreciated.


-- 
Gregor J. Rothfuss
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://wyona.com                   http://cocoon.apache.org/lenya
gregor.rothfuss@wyona.com                       gregor@apache.org

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


Re: Replacing client-side redirects with server-side

Posted by Andreas Hartmann <an...@apache.org>.
Peter Shipley wrote:
> Andreas Hartmann wrote:
> 

[...]

>> A possible solution could be an input module which calls the
>> DocumentBuilder of the current publication:
>>
>> {document-url:{page-envelope:area}:{page-envelope:document-id}:{page-envelope:document-language}} 
>>
>>
>> (the example would generate the document URL of the currently requested
>> document)
>>
> 
> I guess the only reason this isn't totally sorted is it takes the 
> language of the current document as opposed to the language of the 
> created document. I noticed if you view an english language and create a 
> german document you get the english language not available error, so its 
>   trying to redirect the user to the english version of the document 
> which doesn't exist.
> 
> Is this the problem you are referring to which requires the aid of the 
> document helper that appears in the XSP?

Well, it's not a matter of the technical detail "language",
but rather of SoC.

In Lenya, the DocumentBuilder is responsible for mapping URLs
to documents and vice versa. This should *not* be done in the
sitemap.

For instance, if you use a DocumentBuilder in your publication
which does not follow the pattern

   URL = {area}{document-id}(_{language}){extension}
         (authoring/foo_de.html)

but rather

   URL = {language}{document-id}_{area}
         (de/foo/bar_authoring)

a hard-coded URL assembling in the sitemap will fail.

-- Andreas


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


Re: Replacing client-side redirects with server-side

Posted by Rolf Kulemann <ro...@apache.org>.
On Sun, 2004-07-25 at 12:07, Andreas Hartmann wrote:
> Andreas Hartmann wrote:
> > Peter Shipley wrote:
> > 
> > [...]
> > 
> >> OK, taken this onboard and come up with the following for 
> >> usecase.xmap->create
> >>
> >> <map:redirect-to 
> >> uri="{document-url:{page-envelope:area}:{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}:{request-param:properties.create.language}}"/> 
> >>
> >>
> >>
> >> and then created a document url input module that takes the attributes 
> >> and uses the DocumentHelper to construct the URL. All seems well. This 
> >> seems to work fine so are there any other anticipated problems 
> >> elsewhere  I should be aware of or would this solve it? Any other 
> >> issues to consider ?
> > 
> > 
> > I think this module is really useful. In 1.4, it can seamlessly be
> > migrated to generate lenya:// URLs using a set of parameters
> > (document-id, language, ...)
> > 
> > Does a bug on this issue exist? If yes, would you like to
> > attach a patch?
> 
> I applied the patch, thank you very much!

Thx Andreas and Peter.

It would be nice to replace all appropriate client side redirects .....
:)

> 
> BTW, IMHO the code is really nice, and no javadoc warnings :)

Cool :)

-- 
Rolf Kulemann


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


Re: Replacing client-side redirects with server-side

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> Peter Shipley wrote:
> 
> [...]
> 
>> OK, taken this onboard and come up with the following for 
>> usecase.xmap->create
>>
>> <map:redirect-to 
>> uri="{document-url:{page-envelope:area}:{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}:{request-param:properties.create.language}}"/> 
>>
>>
>>
>> and then created a document url input module that takes the attributes 
>> and uses the DocumentHelper to construct the URL. All seems well. This 
>> seems to work fine so are there any other anticipated problems 
>> elsewhere  I should be aware of or would this solve it? Any other 
>> issues to consider ?
> 
> 
> I think this module is really useful. In 1.4, it can seamlessly be
> migrated to generate lenya:// URLs using a set of parameters
> (document-id, language, ...)
> 
> Does a bug on this issue exist? If yes, would you like to
> attach a patch?

I applied the patch, thank you very much!

BTW, IMHO the code is really nice, and no javadoc warnings :)

-- Andreas


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


Re: Replacing client-side redirects with server-side

Posted by Andreas Hartmann <an...@apache.org>.
Peter Shipley wrote:

[...]

> OK, taken this onboard and come up with the following for 
> usecase.xmap->create
> 
> <map:redirect-to 
> uri="{document-url:{page-envelope:area}:{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}:{request-param:properties.create.language}}"/> 
> 
> 
> 
> and then created a document url input module that takes the attributes 
> and uses the DocumentHelper to construct the URL. All seems well. This 
> seems to work fine so are there any other anticipated problems elsewhere 
>  I should be aware of or would this solve it? Any other issues to 
> consider ?

I think this module is really useful. In 1.4, it can seamlessly be
migrated to generate lenya:// URLs using a set of parameters
(document-id, language, ...)

Does a bug on this issue exist? If yes, would you like to
attach a patch?

-- Andreas


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


Re: Replacing client-side redirects with server-side

Posted by Peter Shipley <ps...@nomensa.com>.
Brouoght this across from lenya-users

Peter Shipley wrote:

> Andreas Hartmann wrote:
> 
>> Peter Shipley wrote:
>>
>>> I am looking into replacing the lenya client side browser redirects 
>>> (META-REFRESH) into server side redirects and just wondered if the 
>>> following is a good way to start.
>>>
>>> Any feedback ? The right direction ?
>>>
>>> For the create usecase (usecase.xmap) there currently is:
>>>
>>> <map:generate type="serverpages" 
>>> src="{fallback:content/util/redirect-document.xsp}">
>>>    <map:parameter name="document-id" 
>>> value="{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}"/> 
>>>
>>>    <map:parameter name="language" 
>>> value="{request-param:properties.create.language}"/>
>>> </map:generate>
>>> <map:transform src="{fallback:xslt/util/redirect-document.xsl}"/>
>>> <map:serialize/>
>>>
>>>
>>> I changed this to:
>>>
>>> <map:redirect-to 
>>> uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/> 
>>>
>>
>>
>>
>> Unfortunately it's not that easy. In redirect-document.xsp you'll find
>> the following code:
>>
>>       DocumentHelper helper = new DocumentHelper(objectModel);
>>       String url = helper.getDocumentUrl(documentId, area, language);
>>
>> This functionality (building a document URL from document ID,
>> area and language) is not accessible from the sitemap.
>>
>> A possible solution could be an input module which calls the
>> DocumentBuilder of the current publication:
>>
>> {document-url:{page-envelope:area}:{page-envelope:document-id}:{page-envelope:document-language}} 
>>
>>
>> (the example would generate the document URL of the currently requested
>> document)
>>



OK, taken this onboard and come up with the following for 
usecase.xmap->create

<map:redirect-to 
uri="{document-url:{page-envelope:area}:{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}:{request-param:properties.create.language}}"/>


and then created a document url input module that takes the attributes 
and uses the DocumentHelper to construct the URL. All seems well. This 
seems to work fine so are there any other anticipated problems elsewhere 
  I should be aware of or would this solve it? Any other issues to 
consider ?


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


Re: Replacing client-side redirects with server-side

Posted by Rolf Kulemann <ro...@apache.org>.
On Fri, 2004-07-23 at 23:57, Peter Shipley wrote:
> Andreas Hartmann wrote:
> 
> > Peter Shipley wrote:
> > 
> >> I am looking into replacing the lenya client side browser redirects 
> >> (META-REFRESH) into server side redirects and just wondered if the 
> >> following is a good way to start.
> >>
> >> Any feedback ? The right direction ?
> >>
> >> For the create usecase (usecase.xmap) there currently is:
> >>
> >> <map:generate type="serverpages" 
> >> src="{fallback:content/util/redirect-document.xsp}">
> >>    <map:parameter name="document-id" 
> >> value="{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}"/> 
> >>
> >>    <map:parameter name="language" 
> >> value="{request-param:properties.create.language}"/>
> >> </map:generate>
> >> <map:transform src="{fallback:xslt/util/redirect-document.xsl}"/>
> >> <map:serialize/>
> >>
> >>
> >> I changed this to:
> >>
> >> <map:redirect-to 
> >> uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/> 
> >>
> > 
> > 
> > Unfortunately it's not that easy. In redirect-document.xsp you'll find
> > the following code:
> > 
> >       DocumentHelper helper = new DocumentHelper(objectModel);
> >       String url = helper.getDocumentUrl(documentId, area, language);
> > 
> > This functionality (building a document URL from document ID,
> > area and language) is not accessible from the sitemap.
> > 
> > A possible solution could be an input module which calls the
> > DocumentBuilder of the current publication:
> > 
> > {document-url:{page-envelope:area}:{page-envelope:document-id}:{page-envelope:document-language}} 
> > 
> > 
> > (the example would generate the document URL of the currently requested
> > document)
> > 
> 
> I guess the only reason this isn't totally sorted is it takes the 
> language of the current document as opposed to the language of the 
> created document. I noticed if you view an english language and create a 
> german document you get the english language not available error, so its 
>    trying to redirect the user to the english version of the document 
> which doesn't exist.
> 
> Is this the problem you are referring to which requires the aid of the 
> document helper that appears in the XSP?

Uuh, this all sounds too technical for me :)

Would u mind moving this discussion to lenya-dev ?

We are looking forward to replace the client side redirects for a long
time, so please keep on with ur efforts and thank u.

-- 
Rolf Kulemann


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


Re: Replacing client-side redirects with server-side

Posted by Peter Shipley <ps...@nomensa.com>.
Andreas Hartmann wrote:

> Peter Shipley wrote:
> 
>> I am looking into replacing the lenya client side browser redirects 
>> (META-REFRESH) into server side redirects and just wondered if the 
>> following is a good way to start.
>>
>> Any feedback ? The right direction ?
>>
>> For the create usecase (usecase.xmap) there currently is:
>>
>> <map:generate type="serverpages" 
>> src="{fallback:content/util/redirect-document.xsp}">
>>    <map:parameter name="document-id" 
>> value="{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}"/> 
>>
>>    <map:parameter name="language" 
>> value="{request-param:properties.create.language}"/>
>> </map:generate>
>> <map:transform src="{fallback:xslt/util/redirect-document.xsl}"/>
>> <map:serialize/>
>>
>>
>> I changed this to:
>>
>> <map:redirect-to 
>> uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/> 
>>
> 
> 
> Unfortunately it's not that easy. In redirect-document.xsp you'll find
> the following code:
> 
>       DocumentHelper helper = new DocumentHelper(objectModel);
>       String url = helper.getDocumentUrl(documentId, area, language);
> 
> This functionality (building a document URL from document ID,
> area and language) is not accessible from the sitemap.
> 
> A possible solution could be an input module which calls the
> DocumentBuilder of the current publication:
> 
> {document-url:{page-envelope:area}:{page-envelope:document-id}:{page-envelope:document-language}} 
> 
> 
> (the example would generate the document URL of the currently requested
> document)
> 

I guess the only reason this isn't totally sorted is it takes the 
language of the current document as opposed to the language of the 
created document. I noticed if you view an english language and create a 
german document you get the english language not available error, so its 
   trying to redirect the user to the english version of the document 
which doesn't exist.

Is this the problem you are referring to which requires the aid of the 
document helper that appears in the XSP?


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


Re: Replacing client-side redirects with server-side

Posted by Andreas Hartmann <an...@apache.org>.
Peter Shipley wrote:
> I am looking into replacing the lenya client side browser redirects 
> (META-REFRESH) into server side redirects and just wondered if the 
> following is a good way to start.
> 
> Any feedback ? The right direction ?
> 
> For the create usecase (usecase.xmap) there currently is:
> 
> <map:generate type="serverpages" 
> src="{fallback:content/util/redirect-document.xsp}">
>    <map:parameter name="document-id" 
> value="{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}"/> 
> 
>    <map:parameter name="language" 
> value="{request-param:properties.create.language}"/>
> </map:generate>
> <map:transform src="{fallback:xslt/util/redirect-document.xsl}"/>
> <map:serialize/>
> 
> 
> I changed this to:
> 
> <map:redirect-to 
> uri="/{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}/{request-param:properties.create.parent-id}/{request-param:properties.create.child-id}.{page-envelope:document-extension}"/> 
> 

Unfortunately it's not that easy. In redirect-document.xsp you'll find
the following code:

       DocumentHelper helper = new DocumentHelper(objectModel);
       String url = helper.getDocumentUrl(documentId, area, language);

This functionality (building a document URL from document ID,
area and language) is not accessible from the sitemap.

A possible solution could be an input module which calls the
DocumentBuilder of the current publication:

{document-url:{page-envelope:area}:{page-envelope:document-id}:{page-envelope:document-language}}

(the example would generate the document URL of the currently requested
document)

-- Andreas


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