Re: Getting Parameters from URL

2011-05-15 Thread Jeremy Thomerson
Hielke's response is spot-on.  The real question is: why do you need to
access parameters in your session?  At least your example is concerning -
it's not typically a good sign to be pulling the User ID from the request
(where it looks like you're using it to create a session for a user).


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


On Fri, May 13, 2011 at 2:58 AM, Hielke Hoeve wrote:

> This is because a session is created only once for each user, until it
> expires ofcourse...
> If you wish to check url parameters for each request I would suggest you
> do this in RequestCycle.onBeginRequest(). There is also
> RequestCylce.onEndRequest() if you need to do anything at the end of the
> cycle (letting go of variables and what not).
>
> If you want to check parameters only for a few pages then you could also
> choose to use the Page(PageParameters) constructor, wicket will give
> that constructor a hashmap with all the parameters from the url.
>
> Hielke
>
> -Original Message-
> From: drf [mailto:davidrfi...@gmail.com]
> Sent: donderdag 12 mei 2011 15:49
> To: users@wicket.apache.org
> Subject: Getting Parameters from URL
>
> We have code in our session object as follows:
>
> public class OurSession extends WebSession {
>
>   public OurSession(Request request)}{
>   super(request)
>   // GET PARAMETERS FROM REQUEST
>   userId = request.getParameter("userId");
>  }
>
> }
>
> This works the first time, so if the url has a parameter of userId=JOHN
> then this can be picked up in the above code.
> However, if the application is again requested from the browser (and the
> session already exists), this code will not get called.
> What is then the best way to pick up the parameters on the url?
> Thanks
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Getting-Parameters-from-URL-t
> p3517499p3517499.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


RE: Getting Parameters from URL

2011-05-12 Thread Hielke Hoeve
This is because a session is created only once for each user, until it
expires ofcourse...
If you wish to check url parameters for each request I would suggest you
do this in RequestCycle.onBeginRequest(). There is also
RequestCylce.onEndRequest() if you need to do anything at the end of the
cycle (letting go of variables and what not).

If you want to check parameters only for a few pages then you could also
choose to use the Page(PageParameters) constructor, wicket will give
that constructor a hashmap with all the parameters from the url. 

Hielke

-Original Message-
From: drf [mailto:davidrfi...@gmail.com] 
Sent: donderdag 12 mei 2011 15:49
To: users@wicket.apache.org
Subject: Getting Parameters from URL

We have code in our session object as follows:

public class OurSession extends WebSession {

   public OurSession(Request request)}{
   super(request)
   // GET PARAMETERS FROM REQUEST
   userId = request.getParameter("userId");
  }

}

This works the first time, so if the url has a parameter of userId=JOHN
then this can be picked up in the above code.
However, if the application is again requested from the browser (and the
session already exists), this code will not get called.
What is then the best way to pick up the parameters on the url?
Thanks


--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Getting-Parameters-from-URL-t
p3517499p3517499.html
Sent from the Users forum mailing list archive at Nabble.com.

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


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



Re: Getting Parameters from URL

2011-05-12 Thread Andrea Del Bene

Hi,

in your you can use static method RequestCycle.get().getRequest() to get 
the current request and extract parameters.

We have code in our session object as follows:

public class OurSession extends WebSession {

public OurSession(Request request)}{
super(request)
// GET PARAMETERS FROM REQUEST
userId = request.getParameter("userId");
   }

}

This works the first time, so if the url has a parameter of userId=JOHN
then this can be picked up in the above code.
However, if the application is again requested from the browser (and the
session already exists), this code will not get called.
What is then the best way to pick up the parameters on the url?
Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Getting-Parameters-from-URL-tp3517499p3517499.html
Sent from the Users forum mailing list archive at Nabble.com.

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






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



Getting Parameters from URL

2011-05-12 Thread drf
We have code in our session object as follows:

public class OurSession extends WebSession {

   public OurSession(Request request)}{
   super(request)
   // GET PARAMETERS FROM REQUEST
   userId = request.getParameter("userId");
  }

}

This works the first time, so if the url has a parameter of userId=JOHN
then this can be picked up in the above code.
However, if the application is again requested from the browser (and the
session already exists), this code will not get called.
What is then the best way to pick up the parameters on the url?
Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Getting-Parameters-from-URL-tp3517499p3517499.html
Sent from the Users forum mailing list archive at Nabble.com.

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