You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Matej Knopp <ma...@gmail.com> on 2007/09/27 13:14:38 UTC

We need to know whether page is stateless _before_ render starts

Hi all,

we have a problem currently. We have a situation, when session is
bound in the middle of page rendering. That causes problems with
appending session id to URL.

Let's have a situation like this:
Page with 1 bookmarkable link and one listener interface link. This is
the first page rendered, session is not bound yet.

When the bookmarkable link is being rendered, the container doesn't
append session id to it, because the session is not bound yet. It's
bound only when the listener interface link is being rendered, as at
that point wicket knows that the page is stateful. So on rendered
page, the first bookmarkable link is without session id.

I think the proper solution would be doing a bit of less magic - each
component should report it's statefullness even without rendering the
URL, so we should be a able to determine if page is statefull after
beforeRendere, before the actual rendering. So the session could be
bound properly and all links on page would contain session Id.

-Matej

Re: We need to know whether page is stateless _before_ render starts

Posted by Johan Compagner <jc...@gmail.com>.
i didn't but matej needed it

johan



On 10/16/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> Did we take any action for this? Is/ was there a JIRA issue for it?
>
> Eelco
>
> On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> > call it earlier then.
> >
> > we could do this in the onBeforeRender of a page:
> >
> > (session != binded && !isPageStateless())
> > {
> > session.bind()
> > }
> >
> > johan
> >
> >
> >
> > On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> > >
> > > But the problem is where we call session.bind() now. IIRC we call it
> > > in first urlFor call with session relative URL. and this happens only
> > > during render.
> > >
> > > -Matej
> > >
> > > On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> > > > We already have that what you say the component should report if it
> is
> > > > stateless or not
> > > > (getStatelessHint())
> > > >
> > > >
> > > > So Page.isPageStateless() already pretty much gives you the right
> value.
> > > > even in onBeforeRender()
> > > > The only exception would be if you have all really bookmarkable
> links
> > > but
> > > > (without any statefull behaviors like ajax) and internally somewhere
> you
> > > do
> > > > urlFor()
> > > > your self (inside a behavior and you don't return false in the
> > > > getStatelessHint())
> > > >
> > > > The only other problem is maybe statelessforms, because those are
> > > stateless
> > > > if the rest
> > > > is stateless and if not then they are not, but i guess this is
> solved
> > > > already by always being hybrid?
> > > > (and we can handle session expires now for a page with such a form
> so i
> > > > guess this is not a problem)
> > > >
> > > > johan
> > > >
> > > >
> > > >
> > > >
> > > > On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> > > > >
> > > > > Hi all,
> > > > >
> > > > > we have a problem currently. We have a situation, when session is
> > > > > bound in the middle of page rendering. That causes problems with
> > > > > appending session id to URL.
> > > > >
> > > > > Let's have a situation like this:
> > > > > Page with 1 bookmarkable link and one listener interface link.
> This is
> > > > > the first page rendered, session is not bound yet.
> > > > >
> > > > > When the bookmarkable link is being rendered, the container
> doesn't
> > > > > append session id to it, because the session is not bound yet.
> It's
> > > > > bound only when the listener interface link is being rendered, as
> at
> > > > > that point wicket knows that the page is stateful. So on rendered
> > > > > page, the first bookmarkable link is without session id.
> > > > >
> > > > > I think the proper solution would be doing a bit of less magic -
> each
> > > > > component should report it's statefullness even without rendering
> the
> > > > > URL, so we should be a able to determine if page is statefull
> after
> > > > > beforeRendere, before the actual rendering. So the session could
> be
> > > > > bound properly and all links on page would contain session Id.
> > > > >
> > > > > -Matej
> > > > >
> > > >
> > >
> >
>

Re: We need to know whether page is stateless _before_ render starts

Posted by Eelco Hillenius <ee...@gmail.com>.
Did we take any action for this? Is/ was there a JIRA issue for it?

Eelco

On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> call it earlier then.
>
> we could do this in the onBeforeRender of a page:
>
> (session != binded && !isPageStateless())
> {
> session.bind()
> }
>
> johan
>
>
>
> On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> >
> > But the problem is where we call session.bind() now. IIRC we call it
> > in first urlFor call with session relative URL. and this happens only
> > during render.
> >
> > -Matej
> >
> > On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> > > We already have that what you say the component should report if it is
> > > stateless or not
> > > (getStatelessHint())
> > >
> > >
> > > So Page.isPageStateless() already pretty much gives you the right value.
> > > even in onBeforeRender()
> > > The only exception would be if you have all really bookmarkable links
> > but
> > > (without any statefull behaviors like ajax) and internally somewhere you
> > do
> > > urlFor()
> > > your self (inside a behavior and you don't return false in the
> > > getStatelessHint())
> > >
> > > The only other problem is maybe statelessforms, because those are
> > stateless
> > > if the rest
> > > is stateless and if not then they are not, but i guess this is solved
> > > already by always being hybrid?
> > > (and we can handle session expires now for a page with such a form so i
> > > guess this is not a problem)
> > >
> > > johan
> > >
> > >
> > >
> > >
> > > On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > we have a problem currently. We have a situation, when session is
> > > > bound in the middle of page rendering. That causes problems with
> > > > appending session id to URL.
> > > >
> > > > Let's have a situation like this:
> > > > Page with 1 bookmarkable link and one listener interface link. This is
> > > > the first page rendered, session is not bound yet.
> > > >
> > > > When the bookmarkable link is being rendered, the container doesn't
> > > > append session id to it, because the session is not bound yet. It's
> > > > bound only when the listener interface link is being rendered, as at
> > > > that point wicket knows that the page is stateful. So on rendered
> > > > page, the first bookmarkable link is without session id.
> > > >
> > > > I think the proper solution would be doing a bit of less magic - each
> > > > component should report it's statefullness even without rendering the
> > > > URL, so we should be a able to determine if page is statefull after
> > > > beforeRendere, before the actual rendering. So the session could be
> > > > bound properly and all links on page would contain session Id.
> > > >
> > > > -Matej
> > > >
> > >
> >
>

Re: We need to know whether page is stateless _before_ render starts

Posted by Johan Compagner <jc...@gmail.com>.
call it earlier then.

we could do this in the onBeforeRender of a page:

(session != binded && !isPageStateless())
{
session.bind()
}

johan



On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
>
> But the problem is where we call session.bind() now. IIRC we call it
> in first urlFor call with session relative URL. and this happens only
> during render.
>
> -Matej
>
> On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> > We already have that what you say the component should report if it is
> > stateless or not
> > (getStatelessHint())
> >
> >
> > So Page.isPageStateless() already pretty much gives you the right value.
> > even in onBeforeRender()
> > The only exception would be if you have all really bookmarkable links
> but
> > (without any statefull behaviors like ajax) and internally somewhere you
> do
> > urlFor()
> > your self (inside a behavior and you don't return false in the
> > getStatelessHint())
> >
> > The only other problem is maybe statelessforms, because those are
> stateless
> > if the rest
> > is stateless and if not then they are not, but i guess this is solved
> > already by always being hybrid?
> > (and we can handle session expires now for a page with such a form so i
> > guess this is not a problem)
> >
> > johan
> >
> >
> >
> >
> > On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> > >
> > > Hi all,
> > >
> > > we have a problem currently. We have a situation, when session is
> > > bound in the middle of page rendering. That causes problems with
> > > appending session id to URL.
> > >
> > > Let's have a situation like this:
> > > Page with 1 bookmarkable link and one listener interface link. This is
> > > the first page rendered, session is not bound yet.
> > >
> > > When the bookmarkable link is being rendered, the container doesn't
> > > append session id to it, because the session is not bound yet. It's
> > > bound only when the listener interface link is being rendered, as at
> > > that point wicket knows that the page is stateful. So on rendered
> > > page, the first bookmarkable link is without session id.
> > >
> > > I think the proper solution would be doing a bit of less magic - each
> > > component should report it's statefullness even without rendering the
> > > URL, so we should be a able to determine if page is statefull after
> > > beforeRendere, before the actual rendering. So the session could be
> > > bound properly and all links on page would contain session Id.
> > >
> > > -Matej
> > >
> >
>

Re: We need to know whether page is stateless _before_ render starts

Posted by Matej Knopp <ma...@gmail.com>.
But the problem is where we call session.bind() now. IIRC we call it
in first urlFor call with session relative URL. and this happens only
during render.

-Matej

On 9/27/07, Johan Compagner <jc...@gmail.com> wrote:
> We already have that what you say the component should report if it is
> stateless or not
> (getStatelessHint())
>
>
> So Page.isPageStateless() already pretty much gives you the right value.
> even in onBeforeRender()
> The only exception would be if you have all really bookmarkable links but
> (without any statefull behaviors like ajax) and internally somewhere you do
> urlFor()
> your self (inside a behavior and you don't return false in the
> getStatelessHint())
>
> The only other problem is maybe statelessforms, because those are stateless
> if the rest
> is stateless and if not then they are not, but i guess this is solved
> already by always being hybrid?
> (and we can handle session expires now for a page with such a form so i
> guess this is not a problem)
>
> johan
>
>
>
>
> On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
> >
> > Hi all,
> >
> > we have a problem currently. We have a situation, when session is
> > bound in the middle of page rendering. That causes problems with
> > appending session id to URL.
> >
> > Let's have a situation like this:
> > Page with 1 bookmarkable link and one listener interface link. This is
> > the first page rendered, session is not bound yet.
> >
> > When the bookmarkable link is being rendered, the container doesn't
> > append session id to it, because the session is not bound yet. It's
> > bound only when the listener interface link is being rendered, as at
> > that point wicket knows that the page is stateful. So on rendered
> > page, the first bookmarkable link is without session id.
> >
> > I think the proper solution would be doing a bit of less magic - each
> > component should report it's statefullness even without rendering the
> > URL, so we should be a able to determine if page is statefull after
> > beforeRendere, before the actual rendering. So the session could be
> > bound properly and all links on page would contain session Id.
> >
> > -Matej
> >
>

Re: We need to know whether page is stateless _before_ render starts

Posted by Johan Compagner <jc...@gmail.com>.
We already have that what you say the component should report if it is
stateless or not
(getStatelessHint())


So Page.isPageStateless() already pretty much gives you the right value.
even in onBeforeRender()
The only exception would be if you have all really bookmarkable links but
(without any statefull behaviors like ajax) and internally somewhere you do
urlFor()
your self (inside a behavior and you don't return false in the
getStatelessHint())

The only other problem is maybe statelessforms, because those are stateless
if the rest
is stateless and if not then they are not, but i guess this is solved
already by always being hybrid?
(and we can handle session expires now for a page with such a form so i
guess this is not a problem)

johan




On 9/27/07, Matej Knopp <ma...@gmail.com> wrote:
>
> Hi all,
>
> we have a problem currently. We have a situation, when session is
> bound in the middle of page rendering. That causes problems with
> appending session id to URL.
>
> Let's have a situation like this:
> Page with 1 bookmarkable link and one listener interface link. This is
> the first page rendered, session is not bound yet.
>
> When the bookmarkable link is being rendered, the container doesn't
> append session id to it, because the session is not bound yet. It's
> bound only when the listener interface link is being rendered, as at
> that point wicket knows that the page is stateful. So on rendered
> page, the first bookmarkable link is without session id.
>
> I think the proper solution would be doing a bit of less magic - each
> component should report it's statefullness even without rendering the
> URL, so we should be a able to determine if page is statefull after
> beforeRendere, before the actual rendering. So the session could be
> bound properly and all links on page would contain session Id.
>
> -Matej
>