You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by grazia <Gr...@gmail.com> on 2012/03/02 18:03:31 UTC

loosing custom wicket session

I am upgrading from wicket 1.4 to wicket 1.5.4 for an application containing
lots of legacy servlets and in which wicket has been recently introduced. 
The login page creates my custom wicket session and logs me into the
application without a problem. 
Next, I try to reach a wicket page from 
<span class='viewbutton' onClick=\&quot;location.href='&quot; +
wicketPageName + &quot;'\&quot;>
But in that wicket page my custom session no longer contains the fields
initialized at login because a new session has been created at that point. 

The thread shows: 

WebPageRenderer.getAndRemoveBufferedResponse(Url url)
WebPageRenderer.getSessionId()
Session.get()
Application.get().fetchCreateAndSetSession(RequestCycle.get())

why in Session.get(), ThreadContext.getSession() would have to return null ?
Any suggestion to stir me in the right direction would be very appreciated. 










--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439069.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Mar 3, 2012 at 5:08 AM, grazia <Gr...@gmail.com> wrote:
> I did bind the session as you suggested. IN addition, I noticed that I had
> not appropriately accounted for my custom RequestCyle.
> Thank you for your feedback, it was very useful.
> I add the code hoping to help anybody running into this problem.
>
> this.setRequestCycleProvider(new MyRequestCycleProvider());
>
> private final class MyRequestCycleProvider implements IRequestCycleProvider
> {
>
>        @Override
>        public RequestCycle get(RequestCycleContext context) {
>            if (context.getRequest() instanceof WebRequest){
>            return new MyRequestCycle( context );
>            }
>            return this.get(context);

stackoverflowexception ^^

>
>
>        }
>    }
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4440588.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: loosing custom wicket session

Posted by grazia <Gr...@gmail.com>.
I did bind the session as you suggested. IN addition, I noticed that I had
not appropriately accounted for my custom RequestCyle.
Thank you for your feedback, it was very useful.
I add the code hoping to help anybody running into this problem. 

this.setRequestCycleProvider(new MyRequestCycleProvider());
     
private final class MyRequestCycleProvider implements IRequestCycleProvider
{

        @Override
        public RequestCycle get(RequestCycleContext context) {
            if (context.getRequest() instanceof WebRequest){
            return new MyRequestCycle( context );
            }
            return this.get(context);
            

        }
    }


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4440588.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by grazia <Gr...@gmail.com>.
THank you for your reply. 
I'll get back with an update. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4440021.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by vineet semwal <vi...@gmail.com>.
actually session.bind() is only needed once and in wicket side,that
too in case when you already dont have a permanent session(http
session),this behavior is needed in case when you are trying to be
stateless till you actually need to be stateful for eg. you have  a
stateless form in a stateless page and you logged in from there.

you can check if your session is temporary or not by session.istemporary()

i think you should call session.bind() in some wicket page before
doing session related thing in servlet


On Sat, Mar 3, 2012 at 1:40 AM, grazia <Gr...@gmail.com> wrote:
> I just ran my app using wicket 1.4.
> THe wicketsessionfilter allows me to maintain the wicket session from wicket
> page to non-wicket page and back to a wicket page. This ensures that the
> session is bound.
> But with wicket 1.5 the wicketsessionfilter is not binding the session when
> going from a non-wicket page to a wicket page.
>
> Sorry if my last posts are somewhat redundant.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439687.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
thank you,

regards,
Vineet Semwal

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


Re: loosing custom wicket session

Posted by grazia <Gr...@gmail.com>.
I just ran my app using wicket 1.4. 
THe wicketsessionfilter allows me to maintain the wicket session from wicket
page to non-wicket page and back to a wicket page. This ensures that the
session is bound. 
But with wicket 1.5 the wicketsessionfilter is not binding the session when
going from a non-wicket page to a wicket page. 

Sorry if my last posts are somewhat redundant. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439687.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by grazia <Gr...@gmail.com>.
It seems that I am able to create a wicket session in a wicket page and make
it available to non-wicket pages using the WicketSessionFilter; the
wicketsessionfilter nicely binds the session. 
But I am not being able to maintain the wicket session when going from a
non-wicket page to a wicket page. 
so, how do I bind the session at that point ?
(Why was this working with wicket 1.4 ?)



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439672.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by grazia <Gr...@gmail.com>.
I would think that the session needs to be bound before the WicketFilter
creates a new RequestCycle. But what is the best way of doing so ? Please
advise. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439618.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: loosing custom wicket session

Posted by vineet semwal <vi...@gmail.com>.
try session.bind()

On Fri, Mar 2, 2012 at 10:33 PM, grazia <Gr...@gmail.com> wrote:
> I am upgrading from wicket 1.4 to wicket 1.5.4 for an application containing
> lots of legacy servlets and in which wicket has been recently introduced.
> The login page creates my custom wicket session and logs me into the
> application without a problem.
> Next, I try to reach a wicket page from
> <span class='viewbutton' onClick=\&quot;location.href='&quot; +
> wicketPageName + &quot;'\&quot;>
> But in that wicket page my custom session no longer contains the fields
> initialized at login because a new session has been created at that point.
>
> The thread shows:
>
> WebPageRenderer.getAndRemoveBufferedResponse(Url url)
> WebPageRenderer.getSessionId()
> Session.get()
> Application.get().fetchCreateAndSetSession(RequestCycle.get())
>
> why in Session.get(), ThreadContext.getSession() would have to return null ?
> Any suggestion to stir me in the right direction would be very appreciated.
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/loosing-custom-wicket-session-tp4439069p4439069.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
thank you,

regards,
Vineet Semwal

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