You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Haul <ha...@informatik.tu-darmstadt.de> on 2004/01/04 17:05:01 UTC

Re: PATCH: RawRequestParameterModule

joakim verona wrote:
> Hello list,
> 
> This is a patched version of RawRequestParameterModule so that it 
> returns URLencoded request parameters.
> 
> The docs say that whats this module is supposed to do, and I'm shure it 
> did/does in some circumstances.
> 
> I'm trying to do a proper patch entry in bugzilla to,  but I thought the 
> patch might be discussed here first.

>  * RawRequestParameterModule accesses request parameters without 
>  * decoding or casting. It uses the get() method instead of the getParameter() 

>             return java.net.URLEncoder.encode((String)obj);

Doing the cast contradicts the comment and breaks the use for uploads. 
You need to check for an instance of String first and re-encode it only 
if it is a String IIUC.

	Chris.

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


Re: XML Full Merge

Posted by apurva zaveri <az...@yahoo.com>.
Thank you !

Joerg Heinicke <jo...@gmx.de> wrote:First please do not reply to other mails when starting a new thread. 
Your mail can get lost in the other thread and you will get no answer, 
otherwise it's just annoying to have few threads mixed.

Second your problem. The task itself is to be done in XSLT, but the 
question is, how you get the necessary data put together. You read 
already about document() and it's one possible solution with the 
downside of having problems with the caching: 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10203. If only the 
included document is changing the cache isn't invalidate and so you will 
get the old result. You must know if it works for you. Other possible 
solutions are sitemap aggregation, cinclude or xinclude. All three only 
put the XML side by side so that you can transform the merged XML 
structure into this structure you want to have. The XSLT is up to you I 
would say. Instead of using document() you have to use simple XPaths in 
this XML structure.

Joerg

On 07.01.2004 00:10, apurva zaveri wrote:
> 
> 
> How do you do a full merge in cocoon??
> 
> Full merge, occurs when you need to combine two documents with
> slightly different structures and data into a third document. For
> example, you might want to combine a document containing employee
> names with a similar document containing employee addresses. You need
> some way to link the records in the two files, probably through an ID
> field. The following document fragments illustrate a full merge.
> 
> Document 1:
> 
> 
> Smith Marsha
> 
> 
> Document 2:
> 
> 115 Marshal Rd.,
> Greenville, MN 39281
> 
> Merge Result:
> 
> 
> Smith Marsha
> 115 Marshal Rd., Greenville, MN 39281
> 
> 
> 
> 
> I found something
> (http://www.fawcette.com/archives/premier/mgznarch/xml/2001/06jun01/rj0103/rj0103.asp)
> that does it using and xslt. But cocoon does like to support
> document() function in xslt.
> 
> So how can this be done?
> 
> 
> 
> Regards,
> 
> Apurva Zaveri


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



---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

Re: XML Full Merge

Posted by Joerg Heinicke <jo...@gmx.de>.
First please do not reply to other mails when starting a new thread. 
Your mail can get lost in the other thread and you will get no answer, 
otherwise it's just annoying to have few threads mixed.

Second your problem. The task itself is to be done in XSLT, but the 
question is, how you get the necessary data put together. You read 
already about document() and it's one possible solution with the 
downside of having problems with the caching: 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10203. If only the 
included document is changing the cache isn't invalidate and so you will 
get the old result. You must know if it works for you. Other possible 
solutions are sitemap aggregation, cinclude or xinclude. All three only 
put the XML side by side so that you can transform the merged XML 
structure into this structure you want to have. The XSLT is up to you I 
would say. Instead of using document() you have to use simple XPaths in 
this XML structure.

Joerg

On 07.01.2004 00:10, apurva zaveri wrote:
> 
> 
> How do you do a full merge in cocoon??
> 
> Full merge, occurs when you need to combine two documents with
> slightly different structures and data into a third document. For
> example, you might want to combine a document containing employee
> names with a similar document containing employee addresses. You need
> some way to link the records in the two files, probably through an ID
> field. The following document fragments illustrate a full merge.
> 
> Document 1:
> 
> <employees>   <employee id="1" class="super">
> <lastname>Smith</lastname>      <firstname>Marsha</firstname>
> </employee></employees>
> 
> Document 2:
> 
> <employees>   <employee id="1">      <address>115 Marshal Rd.,
> Greenville, MN 39281</address>   </employee></employees>
> 
> Merge Result:
> 
> <employees>   <employee id="1" class="super">
> <lastname>Smith</lastname>      <firstname>Marsha</firstname>
> <address>115 Marshal Rd.,       Greenville, MN 39281</address>
> </employee></employees>
> 
> 
> 
> I found something
> (http://www.fawcette.com/archives/premier/mgznarch/xml/2001/06jun01/rj0103/rj0103.asp)
> that does it using and xslt. But cocoon does like to support
> document() function in xslt.
> 
> So how can this be done?
> 
> 
> 
> Regards,
> 
> Apurva Zaveri


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


XML Full Merge

Posted by apurva zaveri <az...@yahoo.com>.
 

How do you do a full merge in cocoon??

Full merge, occurs when you need to combine two documents with slightly different structures and data into a third document. For example, you might want to combine a document containing employee names with a similar document containing employee addresses. You need some way to link the records in the two files, probably through an ID field. The following document fragments illustrate a full merge.

Document 1:

<employees>   <employee id="1" class="super">      <lastname>Smith</lastname>      <firstname>Marsha</firstname>   </employee></employees>

Document 2:

<employees>   <employee id="1">      <address>115 Marshal Rd.,       Greenville, MN 39281</address>   </employee></employees>

Merge Result:

<employees>   <employee id="1" class="super">      <lastname>Smith</lastname>      <firstname>Marsha</firstname>      <address>115 Marshal Rd.,       Greenville, MN 39281</address>   </employee></employees>

 

I found something (http://www.fawcette.com/archives/premier/mgznarch/xml/2001/06jun01/rj0103/rj0103.asp) that does it using and xslt. But cocoon does like to support document() function in xslt. 

So how can this be done?

 

Regards,

Apurva Zaveri

 

 


---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes

Re: PATCH: RawRequestParameterModule

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
joakim verona wrote:
> Thanks Chris,
> 
> As you might suspect I'm new to the cocoon internals and will try to 
> make a better patch according to your comment.
> 
> Some other questions:
> - Do you think it should still be "RawRequestParameterModule" or should 
> it be a new module?

not sure. maybe just use JXPathMetaModule (see below)

> - I guess I dont understand how this module would be used in an Upload 
> scenario. Do you have any pointers?

pls look into the samples/databases/mod-db/file-upload-blob.xsp one

when using just existing modules for encoded request parameter "bar":

  <component-instance
     class="org.apache.cocoon.components.modules.input.JXPathMetaModule"
     logger="core.mdules.input" name="request-encoder">
     <input-module name="request"/>
     <function name="java.net.URLEncoder" prefix="urlEncoder"/>
  </component-instance>

...

   <map:parameter name="foo"
     value="{request-encoder:urlEncoder:encode(getParameter(.,'bar'))}"/>

might work as well. (note: I haven't checked if this actually works, it 
shouldn't be far off, though)

	Chris.

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


Re: PATCH: RawRequestParameterModule

Posted by Tony Collen <co...@umn.edu>.
joakim verona wrote:

> Thanks Chris,
> 
> As you might suspect I'm new to the cocoon internals and will try to 
> make a better patch according to your comment.
> 
> Some other questions:
> - Do you think it should still be "RawRequestParameterModule" or should 
> it be a new module?
> - I guess I dont understand how this module would be used in an Upload 
> scenario. Do you have any pointers?

I think this should be turned into a generic MetaModule 
(URLEncodingMetaModule), and not restrict it to just request parameters. 
  That way, we can hook any other inputmodule into it.  This would also 
open the need for a URLDecodingMetaModule.


Just my $0.02.

Tony

> 
> /Joakim
> 
> Christian Haul wrote:
> 
>> joakim verona wrote:
>>
>>> Hello list,
>>>
>>> This is a patched version of RawRequestParameterModule so that it 
>>> returns URLencoded request parameters.
>>>
>>> The docs say that whats this module is supposed to do, and I'm shure 
>>> it did/does in some circumstances.
>>>
>>> I'm trying to do a proper patch entry in bugzilla to,  but I thought 
>>> the patch might be discussed here first.
>>
>>
>>
>>>  * RawRequestParameterModule accesses request parameters without  * 
>>> decoding or casting. It uses the get() method instead of the 
>>> getParameter() 
>>
>>
>>
>>>             return java.net.URLEncoder.encode((String)obj);
>>
>>
>>
>> Doing the cast contradicts the comment and breaks the use for uploads. 
>> You need to check for an instance of String first and re-encode it 
>> only if it is a String IIUC.
>>
>>     Chris.
>>
>> ---------------------------------------------------------------------
>> 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: PATCH: RawRequestParameterModule

Posted by joakim verona <jo...@verona.se>.
Thanks Chris,

As you might suspect I'm new to the cocoon internals and will try to 
make a better patch according to your comment.

Some other questions:
- Do you think it should still be "RawRequestParameterModule" or should 
it be a new module?
- I guess I dont understand how this module would be used in an Upload 
scenario. Do you have any pointers?

/Joakim

Christian Haul wrote:

> joakim verona wrote:
>
>> Hello list,
>>
>> This is a patched version of RawRequestParameterModule so that it 
>> returns URLencoded request parameters.
>>
>> The docs say that whats this module is supposed to do, and I'm shure 
>> it did/does in some circumstances.
>>
>> I'm trying to do a proper patch entry in bugzilla to,  but I thought 
>> the patch might be discussed here first.
>
>
>>  * RawRequestParameterModule accesses request parameters without  * 
>> decoding or casting. It uses the get() method instead of the 
>> getParameter() 
>
>
>>             return java.net.URLEncoder.encode((String)obj);
>
>
> Doing the cast contradicts the comment and breaks the use for uploads. 
> You need to check for an instance of String first and re-encode it 
> only if it is a String IIUC.
>
>     Chris.
>
> ---------------------------------------------------------------------
> 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