You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Justus H. Piater" <Ju...@ULg.ac.be> on 2004/01/07 11:14:12 UTC

Indirect linking and request parameters

Hi,

I'm building a site where some pages rely on request parameters
("file.html?parameter=value"), using XSP. All links are known at build
time, so I can in principle build a static site.

- With direct links, the dynamic site ("forrest run") works without
  problems.

- If I build a static site with direct links, the dynamic pages are
  precompiled ok, under the name "file.html_parameter=value".

  PROBLEM 1: The corresponding links in the statically-built pages are
             not rewritten appropriately. They still point to
             "file.html?parameter=value".

  PROBLEM 2: To avoid MIME-Type problems, I think the precompiled
             pages should rather be called
             "file_parameter=value.html".

- PROBLEM 3: I'd rather use indirect links, but there's apparently no
             way to include request parameters.

Am I right about these three problems, or am I missing something?

Problems 1 and 2 are probably Cocoon (rather than Forrest) problems,
right?

Solving Problem 3 would require an enhancement of Cocoon's
LinkRewriterTransformer, in addition to changes on the Forrest end,
right?

Should I file bug reports / feature requests in the appropriate
places?

Thanks,
Justus

-- 
Justus H. Piater, Ph.D.         http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28        Phone: +32-4-366-2279
Université de Liège, Belgium    Fax:   +32-4-366-2620


Re: Indirect linking and request parameters

Posted by Upayavira <uv...@upaya.co.uk>.
Justus H. Piater wrote:

>Upayavira <uv...@upaya.co.uk> wrote on Wed, 07 Jan 2004 10:36:47 +0000:
>
>  
>
>>Justus H. Piater wrote:
>>    
>>
>>>I'm building a site where some pages rely on request parameters
>>>("file.html?parameter=value"), using XSP. All links are known at build
>>>time, so I can in principle build a static site.
>>>...
>>> PROBLEM 1: The corresponding links in the statically-built pages are
>>>            not rewritten appropriately. They still point to
>>>            "file.html?parameter=value".
>>>
>>>      
>>>
>>Do you use 'link view' or 'link gathering'? Look at the top level
>>attributes in your cli.xconf file. The URLs should be rewritten - it
>>is the same code that converts a filename as converts links, so that
>>is strange.
>>    
>>
>
><cocoon verbose="true"  
>        follow-links="true" 
>        precompile-only="false" 
>        confirm-extensions="false">
>
>Not sure what this means; I did not fiddle with link rewriting.
>
>  
>
>>>- PROBLEM 3: I'd rather use indirect links, but there's apparently no
>>>            way to include request parameters.
>>>
>>>      
>>>
>>What is an indirect link?
>>    
>>
>
><link href="site:file"> (terminology from
>http://xml.apache.org/forrest/linking.html)
>
>I'm not an XPath expert, but it seems to me that there is no way to
>include request parameters in XPath expressions, and that in fact the
>whole concept does not fit the XPath philosophy that presupposes
>static, pre-existing XML structures. Finally, it seems that there is
>currently no canonical syntax for referring to dynamically generated,
>parameterized XML, though I don't see anything wrong with such a
>concept.
>
>So, I guess that a pragmatic solution is to stick with direct linking
>for now. For a cleaner solution, use a Generator instead of XSP files
>that take parameters. Ideally though, I think that indirect linking
>should support request parameters.
>
>What does the community think?
>  
>
To this day, I still haven't downloaded Forrest (don't actually need it).

But, working in an offline mode, I do think it better to avoid request 
parameters. Cocoon is just as able to extract values from the actual URL 
as it is from request parameters, and you get a more natural filenames, 
as no mungling is required.

Regards, Upayavira



Re: Indirect linking and request parameters

Posted by "Justus H. Piater" <Ju...@ULg.ac.be>.
Upayavira <uv...@upaya.co.uk> wrote on Wed, 07 Jan 2004 10:36:47 +0000:

> Justus H. Piater wrote:
>>
>>I'm building a site where some pages rely on request parameters
>>("file.html?parameter=value"), using XSP. All links are known at build
>>time, so I can in principle build a static site.
>>...
>>  PROBLEM 1: The corresponding links in the statically-built pages are
>>             not rewritten appropriately. They still point to
>>             "file.html?parameter=value".
>>
> Do you use 'link view' or 'link gathering'? Look at the top level
> attributes in your cli.xconf file. The URLs should be rewritten - it
> is the same code that converts a filename as converts links, so that
> is strange.

<cocoon verbose="true"  
        follow-links="true" 
        precompile-only="false" 
        confirm-extensions="false">

Not sure what this means; I did not fiddle with link rewriting.

>>- PROBLEM 3: I'd rather use indirect links, but there's apparently no
>>             way to include request parameters.
>>
> What is an indirect link?

<link href="site:file"> (terminology from
http://xml.apache.org/forrest/linking.html)

I'm not an XPath expert, but it seems to me that there is no way to
include request parameters in XPath expressions, and that in fact the
whole concept does not fit the XPath philosophy that presupposes
static, pre-existing XML structures. Finally, it seems that there is
currently no canonical syntax for referring to dynamically generated,
parameterized XML, though I don't see anything wrong with such a
concept.

So, I guess that a pragmatic solution is to stick with direct linking
for now. For a cleaner solution, use a Generator instead of XSP files
that take parameters. Ideally though, I think that indirect linking
should support request parameters.

What does the community think?

Justus

-- 
Justus H. Piater, Ph.D.         http://www.montefiore.ulg.ac.be/~piater/
Institut Montefiore, B28        Phone: +32-4-366-2279
Université de Liège, Belgium    Fax:   +32-4-366-2620


Re: Indirect linking and request parameters

Posted by Upayavira <uv...@upaya.co.uk>.
Justus H. Piater wrote:

>Hi,
>
>I'm building a site where some pages rely on request parameters
>("file.html?parameter=value"), using XSP. All links are known at build
>time, so I can in principle build a static site.
>
>- With direct links, the dynamic site ("forrest run") works without
>  problems.
>
>- If I build a static site with direct links, the dynamic pages are
>  precompiled ok, under the name "file.html_parameter=value".
>  
>
In my work on the Cocoon CLI, I have never given any attention to how 
parameter 'mungling' is done. There's code there to do it, but I've 
never used it.

The filename you mention above doesn't look too helpful, does it. It 
should be, as you say, file_parameter=value.html, or some variant.

This would, IMO, need to be done in the mangle method of the 
'org.apache.cocoon.bean.Target' class, probably using 
NetUtils.getExtension() in there somewhere.

>  PROBLEM 1: The corresponding links in the statically-built pages are
>             not rewritten appropriately. They still point to
>             "file.html?parameter=value".
>  
>
Do you use 'link view' or 'link gathering'? Look at the top level 
attributes in your cli.xconf file. The URLs should be rewritten - it is 
the same code that converts a filename as converts links, so that is 
strange.

>  PROBLEM 2: To avoid MIME-Type problems, I think the precompiled
>             pages should rather be called
>             "file_parameter=value.html".
>  
>
I agree. I didn't realise they weren't.

>- PROBLEM 3: I'd rather use indirect links, but there's apparently no
>             way to include request parameters.
>  
>
What is an indirect link?

>Am I right about these three problems, or am I missing something?
>  
>
No, I think you're right.

>Problems 1 and 2 are probably Cocoon (rather than Forrest) problems,
>right?
>  
>
Yup.

>Solving Problem 3 would require an enhancement of Cocoon's
>LinkRewriterTransformer, in addition to changes on the Forrest end,
>right?
>  
>
I'd need to understand what you mean by 'indirect links' to be able to 
comment.

>Should I file bug reports / feature requests in the appropriate
>places?
>  
>
Or even better, supply a patch!

What do others think? If parameter handling is as Justus describes, 
should it be changed?

Regards, Upayavira