Re: [Wicket-user] Accessing HttpSession attributes
On Fri, 22 Jun 2007, Kees de Kooter wrote: > OK. So how am I going to get to the HttpSession directly? Something like ((WebRequest)getRequest). getHttpServletRequest().getSession() . Typically to find this kind of things it's a good idea to get a relevant object (webSession or WebRequest in this case) and then just use the IDE autocomplete to see what kind of methods they have. - Timo -- Timo Rantalaiho Reaktor Innovations Oyhttp://www.ri.fi/ > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
> Yes, indeed it does. Good catch. So you do need to get to the > httpsession directly after all. Which I guess is a bit safer. > > Eelco > OK. So how am I going to get to the HttpSession directly? - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
> But doesn't the SessionStore.getAttribute turn that into > > httpSession.getAttribute(getSessionAttributePrefix(webRequest) + name) > > In HttpSessionStore getSessionAttributePrefix looks like: > > "wicket:" + servletPath + ":" > > So if the old skool app puts "my.user.key" into it's session, wicket > will be looking up "wicket:servletPath:my.user.key" and won't > find anything? Yes, indeed it does. Good catch. So you do need to get to the httpsession directly after all. Which I guess is a bit safer. Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
On Monday 11 June 2007 3:58 pm, Eelco Hillenius escreveu: > > I would like to access HttpSession attributes from a wicket WebSession > > object. Is this possible? > > > > To be specific my WebSession subclass has a getUser() method. This > > user is stored as the session variable "user". > > Note that (Web)Session is an abstraction. If your session store backs > on HttpSession (like the default implementation does), you can provide > your own session object, and let that call super.get/setAttribute. > > public class MySession extends WebSession { > ... > > public User getUser() { > return (User)getAttribute("my.user.key"); > } > ... > } But doesn't the SessionStore.getAttribute turn that into httpSession.getAttribute(getSessionAttributePrefix(webRequest) + name) In HttpSessionStore getSessionAttributePrefix looks like: "wicket:" + servletPath + ":" So if the old skool app puts "my.user.key" into it's session, wicket will be looking up "wicket:servletPath:my.user.key" and won't find anything? - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
Thanks Eelco, this is the kind of solution I was looking for. Kees On 6/11/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > public class MySession extends WebSession { > ... > > public User getUser() { > return (User)getAttribute("my.user.key"); > } > ... > } > > > Eelco > - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
> I would like to access HttpSession attributes from a wicket WebSession > object. Is this possible? > > To be specific my WebSession subclass has a getUser() method. This > user is stored as the session variable "user". Note that (Web)Session is an abstraction. If your session store backs on HttpSession (like the default implementation does), you can provide your own session object, and let that call super.get/setAttribute. public class MySession extends WebSession { ... public User getUser() { return (User)getAttribute("my.user.key"); } ... } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
((webrequest)RequestCycle.get().getRequest())... -igor On 6/11/07, Kees de Kooter <[EMAIL PROTECTED]> wrote: Thanks Igor. I should have been more specific. I would like to access HttpSession attributes from a wicket WebSession object. Is this possible? To be specific my WebSession subclass has a getUser() method. This user is stored as the session variable "user". On 6/11/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > ((webrequest)getrequest()).gethttpservletrequest().getsession() > > -igor > > > > On 6/11/07, Kees de Kooter <[EMAIL PROTECTED] > wrote: > > > > I am currently working on a proof -of-concept of Wicket inside an > > existing Struts app. I need to access some (old skool) session > > attributes from my wicket WebSession. How can this be done? > > > > -- > > Cheers, > > Kees de Kooter > > http://www.boplicity.net > > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- Cheers, Kees de Kooter http://www.boplicity.net - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
Thanks Igor. I should have been more specific. I would like to access HttpSession attributes from a wicket WebSession object. Is this possible? To be specific my WebSession subclass has a getUser() method. This user is stored as the session variable "user". On 6/11/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > ((webrequest)getrequest()).gethttpservletrequest().getsession() > > -igor > > > > On 6/11/07, Kees de Kooter <[EMAIL PROTECTED] > wrote: > > > > I am currently working on a proof -of-concept of Wicket inside an > > existing Struts app. I need to access some (old skool) session > > attributes from my wicket WebSession. How can this be done? > > > > -- > > Cheers, > > Kees de Kooter > > http://www.boplicity.net > > > > > - > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > - > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- Cheers, Kees de Kooter http://www.boplicity.net - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
You can get to the HttpSession through the WebRequest. Assuming your code is in a WebPage: getRequest().getHttpServletRequest().getSession() Enjoy, On Mon, 2007-06-11 at 21:54 +0200, Kees de Kooter wrote: > I am currently working on a proof -of-concept of Wicket inside an > existing Struts app. I need to access some (old skool) session > attributes from my wicket WebSession. How can this be done? > -- Philip A. Chapman Desktop and Web Application Development: Java, .NET, PostgreSQL, MySQL, MSSQL Linux, Windows 2000, Windows XP signature.asc Description: This is a digitally signed message part - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Accessing HttpSession attributes
((webrequest)getrequest()).gethttpservletrequest().getsession() -igor On 6/11/07, Kees de Kooter <[EMAIL PROTECTED]> wrote: I am currently working on a proof -of-concept of Wicket inside an existing Struts app. I need to access some (old skool) session attributes from my wicket WebSession. How can this be done? -- Cheers, Kees de Kooter http://www.boplicity.net - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Accessing HttpSession attributes
I am currently working on a proof -of-concept of Wicket inside an existing Struts app. I need to access some (old skool) session attributes from my wicket WebSession. How can this be done? -- Cheers, Kees de Kooter http://www.boplicity.net - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user