You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sylvain Wallez <sy...@anyware-tech.com> on 2004/10/18 15:52:26 UTC

Re: svn commit: rev 55002 - cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper

unico@apache.org wrote:

>Author: unico
>Date: Mon Oct 18 06:10:24 2004
>New Revision: 55002
>
>Added:
>   cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/ResponseWrapper.java
>Modified:
>   cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
>Log:
>introduce WrappedResponse for preventing internal requests to modify the response headers
>as discussed here: http://marc.theaimsgroup.com/?t=109783260100005&r=1&w=2
>  
>

I haven't followed that discussion, but I think these changes will break 
internal redirects for external requests, as it won't allow to set 
headers in that case.

Example :
<map:match pattern="*/">
  <map:redirect-to uri="cocoon:/index.html"/>
</map:match>

The headers set by the called pipeline will be ignored although they 
should not. A check that the wrapped environment is external and avoid 
wrapping in that case should be enough, I guess.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: svn commit: rev 55002 - cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper

Posted by Unico Hommes <un...@hippo.nl>.
Sylvain Wallez wrote:

> Unico Hommes wrote:
>
>> Sylvain Wallez wrote:
>>
>>> unico@apache.org wrote:
>>>
>>>> Author: unico
>>>> Date: Mon Oct 18 06:10:24 2004
>>>> New Revision: 55002
>>>>
>>>> Added:
>>>>   
>>>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/ResponseWrapper.java 
>>>>
>>>> Modified:
>>>>   
>>>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java 
>>>>
>>>> Log:
>>>> introduce WrappedResponse for preventing internal requests to 
>>>> modify the response headers
>>>> as discussed here: 
>>>> http://marc.theaimsgroup.com/?t=109783260100005&r=1&w=2
>>>>  
>>>>
>>>
>>> I haven't followed that discussion, but I think these changes will 
>>> break internal redirects for external requests, as it won't allow to 
>>> set headers in that case.
>>>
>>> Example :
>>> <map:match pattern="*/">
>>>  <map:redirect-to uri="cocoon:/index.html"/>
>>> </map:match>
>>>
>>> The headers set by the called pipeline will be ignored although they 
>>> should not. A check that the wrapped environment is external and 
>>> avoid wrapping in that case should be enough, I guess.
>>>
>>
>> I see, the TreeProcessor wraps the environment in a 
>> ForwardEnvironmentWrapper in the case of cocoon redirects. Hmm, but 
>> would the check on whether the wrapped environment is an external one 
>> really make the correct distinction though? Wouldn't that check also 
>> match the scenario that started this:
>>
>> <map:match pattern="transformation">
>>  <map:read src="xsl"/>
>> </map:match>
>>
>> <map:match pattern="page">
>>  <map:generate src="xml"/>
>>  <map:transform src="cocoon:/transformation"/>
>>  <map:serialize/>
>> </map:match>
>>
>> Isn't the environment in which the "transformation" pipeline is 
>> processed also an environment wrapping an external one?
>
>
>
> Mmmh... you're right :-)
>
> I guess we should make the distinction between wrappers for internal 
> redirects, that would not wrap the response, and wrappers for cocoon: 
> sources that must wrap the response. A simple additional boolean in 
> the EnvironmentWrapper constructor should to the trick.
>

Yeah, that should do the trick. I'll take care of it. Thanks for 
catching this :-)

--
Unico


Re: svn commit: rev 55002 - cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper

Posted by Sylvain Wallez <sy...@apache.org>.
Unico Hommes wrote:

> Sylvain Wallez wrote:
>
>> unico@apache.org wrote:
>>
>>> Author: unico
>>> Date: Mon Oct 18 06:10:24 2004
>>> New Revision: 55002
>>>
>>> Added:
>>>   
>>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/ResponseWrapper.java 
>>>
>>> Modified:
>>>   
>>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java 
>>>
>>> Log:
>>> introduce WrappedResponse for preventing internal requests to modify 
>>> the response headers
>>> as discussed here: 
>>> http://marc.theaimsgroup.com/?t=109783260100005&r=1&w=2
>>>  
>>>
>>
>> I haven't followed that discussion, but I think these changes will 
>> break internal redirects for external requests, as it won't allow to 
>> set headers in that case.
>>
>> Example :
>> <map:match pattern="*/">
>>  <map:redirect-to uri="cocoon:/index.html"/>
>> </map:match>
>>
>> The headers set by the called pipeline will be ignored although they 
>> should not. A check that the wrapped environment is external and 
>> avoid wrapping in that case should be enough, I guess.
>>
>
> I see, the TreeProcessor wraps the environment in a 
> ForwardEnvironmentWrapper in the case of cocoon redirects. Hmm, but 
> would the check on whether the wrapped environment is an external one 
> really make the correct distinction though? Wouldn't that check also 
> match the scenario that started this:
>
> <map:match pattern="transformation">
>  <map:read src="xsl"/>
> </map:match>
>
> <map:match pattern="page">
>  <map:generate src="xml"/>
>  <map:transform src="cocoon:/transformation"/>
>  <map:serialize/>
> </map:match>
>
> Isn't the environment in which the "transformation" pipeline is 
> processed also an environment wrapping an external one?


Mmmh... you're right :-)

I guess we should make the distinction between wrappers for internal 
redirects, that would not wrap the response, and wrappers for cocoon: 
sources that must wrap the response. A simple additional boolean in the 
EnvironmentWrapper constructor should to the trick.

But I don't have much time to investigate further right now.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: svn commit: rev 55002 - cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper

Posted by Unico Hommes <un...@hippo.nl>.
Sylvain Wallez wrote:

> unico@apache.org wrote:
>
>> Author: unico
>> Date: Mon Oct 18 06:10:24 2004
>> New Revision: 55002
>>
>> Added:
>>   
>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/ResponseWrapper.java 
>>
>> Modified:
>>   
>> cocoon/trunk/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java 
>>
>> Log:
>> introduce WrappedResponse for preventing internal requests to modify 
>> the response headers
>> as discussed here: 
>> http://marc.theaimsgroup.com/?t=109783260100005&r=1&w=2
>>  
>>
>
> I haven't followed that discussion, but I think these changes will 
> break internal redirects for external requests, as it won't allow to 
> set headers in that case.
>
> Example :
> <map:match pattern="*/">
>  <map:redirect-to uri="cocoon:/index.html"/>
> </map:match>
>
> The headers set by the called pipeline will be ignored although they 
> should not. A check that the wrapped environment is external and avoid 
> wrapping in that case should be enough, I guess.
>

I see, the TreeProcessor wraps the environment in a 
ForwardEnvironmentWrapper in the case of cocoon redirects. Hmm, but 
would the check on whether the wrapped environment is an external one 
really make the correct distinction though? Wouldn't that check also 
match the scenario that started this:

<map:match pattern="transformation">
  <map:read src="xsl"/>
</map:match>

<map:match pattern="page">
  <map:generate src="xml"/>
  <map:transform src="cocoon:/transformation"/>
  <map:serialize/>
</map:match>

Isn't the environment in which the "transformation" pipeline is 
processed also an environment wrapping an external one?

--
Unico