You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by 9902468 <vi...@cerion.fi> on 2008/08/20 13:00:53 UTC

[T5] Manipulating response after page is rendered

Hi again list,

I'm trying to implement features that need to modify response with a filter.
Currently my biggest (and only as far as I can tell) problem is that T5
flushes the response in PageResponseRendererImpl.

Thus the response is sent to client before my filter can manipulate response
after the handle method has returned succesfully.

Shouldn't Tapestry filter flush the response?

Any insight to this matter is really welcome!

 - 99
-- 
View this message in context: http://www.nabble.com/-T5--Manipulating-response-after-page-is-rendered-tp19067131p19067131.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] Manipulating response after page is rendered

Posted by Christian Gorbach <ch...@gmx.at>.
instead of using a servlet filter you could try to contribute a own 
MarkupRendererFilter to do the filtering.
advantage: full dom power

I use this nice approach to add meta tag stuff and analytics javascript 
snippets. .....
hope it helps
c)hristian

> Anyone?
>
>
> 9902468 wrote:
>   
>> Hi again list,
>>
>> I'm trying to implement features that need to modify response with a
>> filter. Currently my biggest (and only as far as I can tell) problem is
>> that T5 flushes the response in PageResponseRendererImpl.
>>
>> Thus the response is sent to client before my filter can manipulate
>> response after the handle method has returned succesfully.
>>
>> Shouldn't Tapestry filter flush the response?
>>
>> Any insight to this matter is really welcome!
>>
>>  - 99
>>
>>     
>
>   


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


Re: [T5] Manipulating response after page is rendered

Posted by 9902468 <vi...@cerion.fi>.
Hi, and thanks for the response!

It seems that it is really easy to alter the behavior as I want by just
using filter that change the default Response object as you suggested. Just
why didn't I think of that in the first place.. :)

Well, thanks again.

 - 99


Fernando Padilla wrote:
> 
> Tapestry is not the problem here.  If you write a filter (either j2ee 
> filter or tapestry filter), it is your job to capture and buffer the 
> output if you don't want it to go out to the client before you're ready. 
>   I'm sorry but that is just the way things are ( I can get into 
> technical reasons why, but just trust us ).
> 
> For example, if I was making a j2ee filter, I would pass into the 
> chain.doFilter my own Response object that when someone calls 
> getOutputStream or getPrintWriter, it would return an OutputStream or 
> PrintWriter that dumps the output into a buffer.  Once the 
> chain.doFilter returns, then the filter would use that buffered output 
> to generate the output that it will return the the real Response object 
> handed to it.
> 
> 
> ResponseA (given to Filter by server)
> Filter (sits in between ResponseA and ResponseB to
>          mediate the output from lower parts and higher parts)
> ResponseB (buffering response, given to lower parts by Filter)
> 
> 
> 
> 
> 
> Whether tapestry flushes the output or not is not the problem.
> 
> If you are implementing a Filter (either j2ee Filter or Tapestry level 
> filter), you need to have that filter capture the output
> 
> 9902468 wrote:
>> Anyone?
>> 
>> 
>> 9902468 wrote:
>>> Hi again list,
>>>
>>> I'm trying to implement features that need to modify response with a
>>> filter. Currently my biggest (and only as far as I can tell) problem is
>>> that T5 flushes the response in PageResponseRendererImpl.
>>>
>>> Thus the response is sent to client before my filter can manipulate
>>> response after the handle method has returned succesfully.
>>>
>>> Shouldn't Tapestry filter flush the response?
>>>
>>> Any insight to this matter is really welcome!
>>>
>>>  - 99
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-T5--Manipulating-response-after-page-is-rendered-tp19067131p19102760.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] Manipulating response after page is rendered

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Tapestry is not the problem here.  If you write a filter (either j2ee 
filter or tapestry filter), it is your job to capture and buffer the 
output if you don't want it to go out to the client before you're ready. 
  I'm sorry but that is just the way things are ( I can get into 
technical reasons why, but just trust us ).

For example, if I was making a j2ee filter, I would pass into the 
chain.doFilter my own Response object that when someone calls 
getOutputStream or getPrintWriter, it would return an OutputStream or 
PrintWriter that dumps the output into a buffer.  Once the 
chain.doFilter returns, then the filter would use that buffered output 
to generate the output that it will return the the real Response object 
handed to it.


ResponseA (given to Filter by server)
Filter (sits in between ResponseA and ResponseB to
         mediate the output from lower parts and higher parts)
ResponseB (buffering response, given to lower parts by Filter)





Whether tapestry flushes the output or not is not the problem.

If you are implementing a Filter (either j2ee Filter or Tapestry level 
filter), you need to have that filter capture the output

9902468 wrote:
> Anyone?
> 
> 
> 9902468 wrote:
>> Hi again list,
>>
>> I'm trying to implement features that need to modify response with a
>> filter. Currently my biggest (and only as far as I can tell) problem is
>> that T5 flushes the response in PageResponseRendererImpl.
>>
>> Thus the response is sent to client before my filter can manipulate
>> response after the handle method has returned succesfully.
>>
>> Shouldn't Tapestry filter flush the response?
>>
>> Any insight to this matter is really welcome!
>>
>>  - 99
>>
> 

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


Re: [T5] Manipulating response after page is rendered

Posted by 9902468 <vi...@cerion.fi>.
Anyone?


9902468 wrote:
> 
> Hi again list,
> 
> I'm trying to implement features that need to modify response with a
> filter. Currently my biggest (and only as far as I can tell) problem is
> that T5 flushes the response in PageResponseRendererImpl.
> 
> Thus the response is sent to client before my filter can manipulate
> response after the handle method has returned succesfully.
> 
> Shouldn't Tapestry filter flush the response?
> 
> Any insight to this matter is really welcome!
> 
>  - 99
> 

-- 
View this message in context: http://www.nabble.com/-T5--Manipulating-response-after-page-is-rendered-tp19067131p19082967.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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