You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Delbecq <de...@oma.be> on 2006/09/13 17:01:23 UTC
How does RedirectTrackerManager
Hello,
I've got a bit of problem here with JSF. Somehow, i get my backing bean
linked to the session, while they should be request time only.
Here is my situation
engineBean (request scope) is created by JSF (coming from a <bean>
section in config)
it returns an array of AssignmentBean, using various information from
current user's account. Those bean are wrappers around a proprietary object
then a jsp page has a datatable showing those AssignmentBean (using a
value binding in form #{engineBean.assignments}) using HtmlOutput tags
Questions:
1) How comes those beans, which are supposed to have a request scope
only, end up stored in the session scope object
"org.apache.myfaces.custom.redirectTracker.RedirectTrackerManager"
2) How to prevent this, considering those AssignmentBean are not
serializable and will never be, and a such should never reach the
session level.
Thanks for information, currently this lead to bunch of exception when
stopping tomcat because user sessions can not be serialized anymore!
Re: How does RedirectTrackerManager
Posted by David Delbecq <de...@oma.be>.
Hi,
1) why are my pages getting redirected. This seems to be a behaviour
added by sandbox. I don't think it's needed in myface. How do i
deactivate this redirection thing?
2) This filter is clearly in sandbox, added by a phase cycle listener,
not in myface core, so JSF can live without it, how do i deactivate it?
3) My request parameters do clearly what they are supposed to be, they
are request time. I don't need them anywhere else. Especially the beans
that are created by JSF, the phase listener should be aware that they
are created each time by JSF itself and as such do not need to be stored
as JSF will recreate them after redirect. How do i tell this redirect
listener to remove them after redirection or to not store them?
This is not only a problem of serialization, this is also a problem of
keeping in session objets that should be removed from memory at end of
request. This is a problem when such objects begin to accumulate in the
session. They do not seem to be removed after redirect, meaning my
request time objects will probably grow and grow and grow in user session.
I wonder why this all cumbersome work instead of simply doing an
internal redirect in server?
Well i just need to remove this thing, is it already optional or do i
need to fill a Feature request to make it optional?
Aleksei Valikov a écrit :
> Hi.
>
>> I've got a bit of problem here with JSF. Somehow, i get my backing bean
>> linked to the session, while they should be request time only.
>>
>>
>> Here is my situation
>>
>> engineBean (request scope) is created by JSF (coming from a <bean>
>> section in config)
>> it returns an array of AssignmentBean, using various information from
>> current user's account. Those bean are wrappers around a proprietary
>> object
>> then a jsp page has a datatable showing those AssignmentBean (using a
>> value binding in form #{engineBean.assignments}) using HtmlOutput tags
>>
>>
>> Questions:
>> 1) How comes those beans, which are supposed to have a request scope
>> only, end up stored in the session scope object
>> "org.apache.myfaces.custom.redirectTracker.RedirectTrackerManager"
>> 2) How to prevent this, considering those AssignmentBean are not
>> serializable and will never be, and a such should never reach the
>> session level.
>>
>> Thanks for information, currently this lead to bunch of exception when
>> stopping tomcat because user sessions can not be serialized anymore!
>
> The probem with request scope beans is that they get lost during the
> redirect. If you have a request scoped bean and get redirected (for
> instance if you invoke an action that navigates you to another page
> and it's redirect in navigation), you will actually get two requests.
> Consequently all the request beans instantiated on the first request
> will not appear in the second request. This may be a problem for many
> applications.
>
> The solution is to track down redirects. Every time a redirect is
> executed, a special token is appended to the target URL. Then, upon
> receiving the second request, this token may be used to identify the
> redirect transition. This allows saving request beans in the session
> using the token before redirect and restore them for the request scope
> right after the redirect.
>
> This allows request scope beans survive the redirect (and answers your
> first question).
>
> As for the second question. In order to avoid serialization problems
> you session-based storage of request beans should be transient. If
> it's not the case in MyFaces, then it's a bug. File it or try to
> correct it yourself.
>
> Bye.
> /lexi
Re: How does RedirectTrackerManager
Posted by Aleksei Valikov <va...@gmx.net>.
Hi.
> I've got a bit of problem here with JSF. Somehow, i get my backing bean
> linked to the session, while they should be request time only.
>
>
> Here is my situation
>
> engineBean (request scope) is created by JSF (coming from a <bean>
> section in config)
> it returns an array of AssignmentBean, using various information from
> current user's account. Those bean are wrappers around a proprietary object
> then a jsp page has a datatable showing those AssignmentBean (using a
> value binding in form #{engineBean.assignments}) using HtmlOutput tags
>
>
> Questions:
> 1) How comes those beans, which are supposed to have a request scope
> only, end up stored in the session scope object
> "org.apache.myfaces.custom.redirectTracker.RedirectTrackerManager"
> 2) How to prevent this, considering those AssignmentBean are not
> serializable and will never be, and a such should never reach the
> session level.
>
> Thanks for information, currently this lead to bunch of exception when
> stopping tomcat because user sessions can not be serialized anymore!
The probem with request scope beans is that they get lost during the redirect.
If you have a request scoped bean and get redirected (for instance if you invoke
an action that navigates you to another page and it's redirect in navigation),
you will actually get two requests. Consequently all the request beans
instantiated on the first request will not appear in the second request. This
may be a problem for many applications.
The solution is to track down redirects. Every time a redirect is executed, a
special token is appended to the target URL. Then, upon receiving the second
request, this token may be used to identify the redirect transition. This allows
saving request beans in the session using the token before redirect and restore
them for the request scope right after the redirect.
This allows request scope beans survive the redirect (and answers your first
question).
As for the second question. In order to avoid serialization problems you
session-based storage of request beans should be transient. If it's not the case
in MyFaces, then it's a bug. File it or try to correct it yourself.
Bye.
/lexi