You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andy Huhn <am...@insightbb.com> on 2007/11/09 02:55:25 UTC

T5: Intercepting the body of a component

Hello,

I'm trying to write a component that allows Tapestry to render its body
into the MarkupWriter, and then it performs string substitutions on the
MarkupWriter to "transform" the output before it is sent back to the
client.  Any ideas?

I've looked through a bunch of the source code, and I can't find any
built-in components that "examine" their body, or that even are aware of
their body (other than to return true or false from beginRenderBody).

I thought about using an AfterRender method, getting the MarkupWriter,
and using XPath or some other means to manipulate the latest elements
added.  But it appears that the MarkupWriter doesn't support XPath.

Help?

Thanks,
Andy

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


Re: T5: Intercepting the body of a component

Posted by Andy Huhn <am...@insightbb.com>.
Howard,

Another thing that would be helpful here...to make the MarkupWriter a
property that the component could replace in BeforeRender with its own
local MarkupWriter, allow the body to render into the temporary
MarkupWriter, and then in AfterRender, put the original MarkupWriter
back in place again.  Then the component has isolated into one Document
everything generated by its own body, and it could do its own
transformations and then call write() on the original MarkupWriter.

Thanks,
Andy

On Thu, 2007-11-08 at 19:50 -0800, Howard Lewis Ship wrote:
> This is one of those cases that is, somewhat delibrately, not covered
> by T5 directly.
> 
> I think you are on to something: capturing the Element and working
> your way into the body to re-write the markup generated by the
> components
> in the body.
> 
> Tapestry uses a very light-weight DOM; I wonder if it would be
> possible to hook an existing XPath engine up to it?
> 
> 
> On Nov 8, 2007 5:55 PM, Andy Huhn <am...@insightbb.com> wrote:
> > Hello,
> >
> > I'm trying to write a component that allows Tapestry to render its body
> > into the MarkupWriter, and then it performs string substitutions on the
> > MarkupWriter to "transform" the output before it is sent back to the
> > client.  Any ideas?
> >
> > I've looked through a bunch of the source code, and I can't find any
> > built-in components that "examine" their body, or that even are aware of
> > their body (other than to return true or false from beginRenderBody).
> >
> > I thought about using an AfterRender method, getting the MarkupWriter,
> > and using XPath or some other means to manipulate the latest elements
> > added.  But it appears that the MarkupWriter doesn't support XPath.
> >
> > Help?
> >
> > Thanks,
> > Andy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
> 

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


Re: T5: Intercepting the body of a component

Posted by zack1403 <za...@gmail.com>.
Any progress on being able to grab  and render the component body from the
component class?  I am writing a component that has to display data
recursively and this seems like the best option.

Thanks,
Zack


Howard Lewis Ship wrote:
> 
> This is one of those cases that is, somewhat delibrately, not covered
> by T5 directly.
> 
> I think you are on to something: capturing the Element and working
> your way into the body to re-write the markup generated by the
> components
> in the body.
> 
> Tapestry uses a very light-weight DOM; I wonder if it would be
> possible to hook an existing XPath engine up to it?
> 
> 
> On Nov 8, 2007 5:55 PM, Andy Huhn <am...@insightbb.com> wrote:
>> Hello,
>>
>> I'm trying to write a component that allows Tapestry to render its body
>> into the MarkupWriter, and then it performs string substitutions on the
>> MarkupWriter to "transform" the output before it is sent back to the
>> client.  Any ideas?
>>
>> I've looked through a bunch of the source code, and I can't find any
>> built-in components that "examine" their body, or that even are aware of
>> their body (other than to return true or false from beginRenderBody).
>>
>> I thought about using an AfterRender method, getting the MarkupWriter,
>> and using XPath or some other means to manipulate the latest elements
>> added.  But it appears that the MarkupWriter doesn't support XPath.
>>
>> Help?
>>
>> Thanks,
>> Andy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> Partner and Senior Architect at Feature50
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> 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%3A-Intercepting-the-body-of-a-component-tp13660086p21522507.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: Intercepting the body of a component

Posted by Howard Lewis Ship <hl...@gmail.com>.
This is one of those cases that is, somewhat delibrately, not covered
by T5 directly.

I think you are on to something: capturing the Element and working
your way into the body to re-write the markup generated by the
components
in the body.

Tapestry uses a very light-weight DOM; I wonder if it would be
possible to hook an existing XPath engine up to it?


On Nov 8, 2007 5:55 PM, Andy Huhn <am...@insightbb.com> wrote:
> Hello,
>
> I'm trying to write a component that allows Tapestry to render its body
> into the MarkupWriter, and then it performs string substitutions on the
> MarkupWriter to "transform" the output before it is sent back to the
> client.  Any ideas?
>
> I've looked through a bunch of the source code, and I can't find any
> built-in components that "examine" their body, or that even are aware of
> their body (other than to return true or false from beginRenderBody).
>
> I thought about using an AfterRender method, getting the MarkupWriter,
> and using XPath or some other means to manipulate the latest elements
> added.  But it appears that the MarkupWriter doesn't support XPath.
>
> Help?
>
> Thanks,
> Andy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

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