You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by joakim verona <jo...@verona.se> on 2003/12/24 05:03:10 UTC

how to configure JXPathMetaModule?

Hello,

I would like to URL encode in the sitemap, and I figured the 
JXPathMetamodule would be useful.
However, I cant figure out how to configure it.

The docs mention a "function" element that can be used to define java 
classes to be used with jxpath:

<function name="java.net.URLDecoder" prefix="urlencode"/>

But where do I put this statement?

Then I would like to use the new input module like this:


<match select="test/*">
<generate src="http://www.test.com/{urlencode:encode({1})}"


But that doesnt look quite right.


Any hints?

Regards
/Joakim


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


Re: how to configure JXPathMetaModule?

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
joakim verona wrote:
> Hello,
> 
> I would like to URL encode in the sitemap, and I figured the 
> JXPathMetamodule would be useful.
> However, I cant figure out how to configure it.
> 
> The docs mention a "function" element that can be used to define java 
> classes to be used with jxpath:
> 
> <function name="java.net.URLDecoder" prefix="urlencode"/>
> 
> But where do I put this statement?

Wherever the module is declared or used and may have a nested 
configuration. If you are going to use it from sitemap, you need to add 
this to the declaration.

> Then I would like to use the new input module like this:
> 
> 
> <match select="test/*">
> <generate src="http://www.test.com/{urlencode:encode({1})}"

Nested substitution is not supported. But there is an action for this: 
InputModuleAction. Please see the javadocs.

	Chris.

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


Re: how to configure JXPathMetaModule?

Posted by Nicolas Toper <nt...@jouve.fr>.
Le Mercredi 24 Décembre 2003 12:17, Joakim Verona a écrit :
What's the problem with the Transformer URL Encoder?
> Thanks Konstantin,
>
> It's really kind of difficult to get URL encoding working with cocoon.
> I've tried various workarounds for the basic problem that
> raw-request-parameters
> doesnt really work as documented.
>
> The only thing that works that I've found is having an XSLT do an
> urlencode on an xinclude,
> but that is kind of cumbersome
>
> Regards,
> /Joakim
>
> Konstantin Piroumian wrote:
>
> From: "joakim verona" <jo...@verona.se>
>
> >>Hello,
> >>
> >>I would like to URL encode in the sitemap, and I figured the
> >>JXPathMetamodule would be useful.
> >>However, I cant figure out how to configure it.
> >>
> >>The docs mention a "function" element that can be used to define java
> >>classes to be used with jxpath:
> >>
> >><function name="java.net.URLDecoder" prefix="urlencode"/>
> >
> >I suppose, you should modify the cocoon.xconf to add functions to an input
> >module.
> >
> >>But where do I put this statement?
> >>
> >>Then I would like to use the new input module like this:
> >>
> >>
> >><match select="test/*">
> >><generate src="http://www.test.com/{urlencode:encode({1})}"
> >>
> >>
> >>But that doesnt look quite right.
> >
> >Unfortunately, nested variable evaluation is not supported (at least in C
> >2.1), so the combination of an input module and a sitemap parameter won't
> >work.
> >
> >But things could have changes since the time I last had a look at input
> >modules.
> >
> >Regards,
> >  Konstantin
> >
> >>Any hints?
> >>
> >>Regards
> >>/Joakim
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: how to configure JXPathMetaModule?

Posted by Joakim Verona <jo...@verona.se>.
Thanks Nicolas,

Maybe I was a little bit unclear in my problem description.
It's OK to generate pages with URLencoded URL:s.

This can be done with a transformer, like the one you propose.

The problem is when you click on the url and cocoon gets it back again.
Then cocoon will decode the url, inserting spaces and so on.


So this code will fail if the "titlequery" argument contains spaces:

<map:match pattern="parseimdbtitlequery">
    <map:generate type="html"

src="http://www.imdb.com/Find?for={request-param:titlequery}" />
    <!--  needs url encoding because contains whitespace -->

    <!--map:transform src="stylesheets/parseimdbtitle.xsl"/-->
    <map:serialize type="xml"/>
      </map:match>

Now, raw-request-param is supposed to return the parameter with the
original escapes, but it doesnt,
so that cant be used to solve the problem.

I can fix the problem with url encoding using a small wrapper that url
encodes a xinclude, but
the xinclude doesnt run "jtidy" on the included html, so it will break
on normal webpages like the imdb one
above.

So I guess the only solution is to fix the inputmodules somehow.

/Joakim


Nicolas Toper wrote:

>It is working fine with me (after some research and tuning though :=))
>Le Mercredi 24 Décembre 2003 12:17, Joakim Verona a écrit :
>  
>
>>Thanks Konstantin,
>>
>>It's really kind of difficult to get URL encoding working with cocoon.
>>I've tried various workarounds for the basic problem that
>>raw-request-parameters
>>doesnt really work as documented.
>>
>>The only thing that works that I've found is having an XSLT do an
>>urlencode on an xinclude,
>>but that is kind of cumbersome
>>
>>Regards,
>>/Joakim
>>
>>Konstantin Piroumian wrote:
>>
>>From: "joakim verona" <jo...@verona.se>
>>
>>    
>>
>>>>Hello,
>>>>
>>>>I would like to URL encode in the sitemap, and I figured the
>>>>JXPathMetamodule would be useful.
>>>>However, I cant figure out how to configure it.
>>>>
>>>>The docs mention a "function" element that can be used to define java
>>>>classes to be used with jxpath:
>>>>
>>>><function name="java.net.URLDecoder" prefix="urlencode"/>
>>>>        
>>>>
>>>I suppose, you should modify the cocoon.xconf to add functions to an input
>>>module.
>>>
>>>      
>>>
>>>>But where do I put this statement?
>>>>
>>>>Then I would like to use the new input module like this:
>>>>
>>>>
>>>><match select="test/*">
>>>><generate src="http://www.test.com/{urlencode:encode({1})}"
>>>>
>>>>
>>>>But that doesnt look quite right.
>>>>        
>>>>
>>>Unfortunately, nested variable evaluation is not supported (at least in C
>>>2.1), so the combination of an input module and a sitemap parameter won't
>>>work.
>>>
>>>But things could have changes since the time I last had a look at input
>>>modules.
>>>
>>>Regards,
>>> Konstantin
>>>
>>>      
>>>
>>>>Any hints?
>>>>
>>>>Regards
>>>>/Joakim
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>For additional commands, e-mail: users-help@cocoon.apache.org
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>  
>




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


Re: how to configure JXPathMetaModule?

Posted by Nicolas Toper <nt...@jouve.fr>.
It is working fine with me (after some research and tuning though :=))
Le Mercredi 24 Décembre 2003 12:17, Joakim Verona a écrit :
> Thanks Konstantin,
>
> It's really kind of difficult to get URL encoding working with cocoon.
> I've tried various workarounds for the basic problem that
> raw-request-parameters
> doesnt really work as documented.
>
> The only thing that works that I've found is having an XSLT do an
> urlencode on an xinclude,
> but that is kind of cumbersome
>
> Regards,
> /Joakim
>
> Konstantin Piroumian wrote:
>
> From: "joakim verona" <jo...@verona.se>
>
> >>Hello,
> >>
> >>I would like to URL encode in the sitemap, and I figured the
> >>JXPathMetamodule would be useful.
> >>However, I cant figure out how to configure it.
> >>
> >>The docs mention a "function" element that can be used to define java
> >>classes to be used with jxpath:
> >>
> >><function name="java.net.URLDecoder" prefix="urlencode"/>
> >
> >I suppose, you should modify the cocoon.xconf to add functions to an input
> >module.
> >
> >>But where do I put this statement?
> >>
> >>Then I would like to use the new input module like this:
> >>
> >>
> >><match select="test/*">
> >><generate src="http://www.test.com/{urlencode:encode({1})}"
> >>
> >>
> >>But that doesnt look quite right.
> >
> >Unfortunately, nested variable evaluation is not supported (at least in C
> >2.1), so the combination of an input module and a sitemap parameter won't
> >work.
> >
> >But things could have changes since the time I last had a look at input
> >modules.
> >
> >Regards,
> >  Konstantin
> >
> >>Any hints?
> >>
> >>Regards
> >>/Joakim
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: how to configure JXPathMetaModule?

Posted by Joakim Verona <jo...@verona.se>.
Thanks Konstantin,

It's really kind of difficult to get URL encoding working with cocoon.
I've tried various workarounds for the basic problem that 
raw-request-parameters
doesnt really work as documented.

The only thing that works that I've found is having an XSLT do an 
urlencode on an xinclude,
but that is kind of cumbersome

Regards,
/Joakim

Konstantin Piroumian wrote:

>From: "joakim verona" <jo...@verona.se>
>
>  
>
>>Hello,
>>
>>I would like to URL encode in the sitemap, and I figured the
>>JXPathMetamodule would be useful.
>>However, I cant figure out how to configure it.
>>
>>The docs mention a "function" element that can be used to define java
>>classes to be used with jxpath:
>>
>><function name="java.net.URLDecoder" prefix="urlencode"/>
>>    
>>
>
>I suppose, you should modify the cocoon.xconf to add functions to an input
>module.
>
>  
>
>>But where do I put this statement?
>>
>>Then I would like to use the new input module like this:
>>
>>
>><match select="test/*">
>><generate src="http://www.test.com/{urlencode:encode({1})}"
>>
>>
>>But that doesnt look quite right.
>>    
>>
>
>Unfortunately, nested variable evaluation is not supported (at least in C
>2.1), so the combination of an input module and a sitemap parameter won't
>work.
>
>But things could have changes since the time I last had a look at input
>modules.
>
>Regards,
>  Konstantin
>
>  
>
>>Any hints?
>>
>>Regards
>>/Joakim
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>  
>



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


Re: how to configure JXPathMetaModule?

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "joakim verona" <jo...@verona.se>

> Hello,
>
> I would like to URL encode in the sitemap, and I figured the
> JXPathMetamodule would be useful.
> However, I cant figure out how to configure it.
>
> The docs mention a "function" element that can be used to define java
> classes to be used with jxpath:
>
> <function name="java.net.URLDecoder" prefix="urlencode"/>

I suppose, you should modify the cocoon.xconf to add functions to an input
module.

>
> But where do I put this statement?
>
> Then I would like to use the new input module like this:
>
>
> <match select="test/*">
> <generate src="http://www.test.com/{urlencode:encode({1})}"
>
>
> But that doesnt look quite right.

Unfortunately, nested variable evaluation is not supported (at least in C
2.1), so the combination of an input module and a sitemap parameter won't
work.

But things could have changes since the time I last had a look at input
modules.

Regards,
  Konstantin

>
>
> Any hints?
>
> Regards
> /Joakim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>


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