dev@javaserverfaces.java.net

Re: About InterweavingResponse

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 19 Sep 2007 09:47:56 -0700

Consider the following JSP:

<html>
<head><title>title</title></head>
<body>
<f:view>
    ... (some jsf tags) ...
</f:view>
</body>
</html>

In JSF 1.2 the building of the tree and rendering occur in two steps.

Step 1 dispatches a request to the target JSP with the response wrapped
with the InterweavingResponse implementation.
During the dispatch, as soon as we hit the starting f:view tag, we flush
the content written to the InterweavingResponse.
This content represents everything above the view tag. The handling of
the content between the view tags is a little more
complex. In short, the tags get executed causing the components to be
created. Any template text that may exist as body
content to a tag is stored in the BodyContext object of the tag in
question. After all of the JSF tags have been processed,
the only other content that will have been written to the
InterweavingResponse is that content that appears after the
f:view tag. This will be cached to be written later *after* the
component tree has been rendered.

Step 2 renders the JSF component tree. This part I'm assuming you're
familiar with. Now your question on markers.
No, renderers don't know anything about the markers. The state marker
that is written is done so by the ViewHandler
when ViewHandler.writeState() is called by which ever renderer needs to
do so. The FormRenderer is the only component
in the default component set that will do this.

After the component tree has been rendered and the state markers have
been replaced, we then write the content
that appears after f:view.

Hope this helps.

Gurkan Erdogdu wrote:
> Hi,
>
> I do not understand that the implementation use wrapper around the
> actual servlet response to write any content after <f:view> tag into
> the proper position. What does it mean that any content after the
> <f:view> tag?
>
> In JSF 1.2 RI, rendering and responsing cleanly seperated. Then, when
> dispatching request to the jsp container, container just create the
> component tree. Does it write anything to the wrapper response object?
>
> Is it true that writing to the component markers to the response is
> the responsibility of the renderers?
>
> I want to understand the code but render view phase implementation
> seems very complex :)
>
> Thanks for answers;
>
> Gurkan
>
> ------------------------------------------------------------------------
> Check out
> <http://us.rd.yahoo.com/evt=51201/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE5NWVzZGVyBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDYXV0b3MtbmV3Y2Fy>
> the hottest 2008 models today at Yahoo! Autos.