From: Geoff T. <gta...@na...> - 2001-08-09 20:55:36
|
At 01:40 PM 8/9/01 -0700, Keith F Irwin wrote: >I like using a dispatcher model where I can read and write values to the >request object. Scanning the method lists and finally the code for >HTTPRequest, I can't see a way to do this, something similar to java's >request.setAttribute("name", value). I think the java implementation of >all this has a dictionary for "attributes" and one for "parameters". Does >webware not? > >Perhaps webware has divided stuff up differently. I'd like to stuff >things in the request object via a handler (non Page derived code), then >push that info to a Servlet derived from "Page" for presentation. > >Is there a preferred method for this? Some other object than request()? > >(I'm not talking emulating beans, for which "cans" exist here, I think.) > >Keith In Webware CVS, we've added HTTPRequest.setField(). Combine that with Application.forward() and/or Application.includeURL() to pass control to another servlet and you've got what you want. So, grab a snapshot from CVS. The tip seems very stable to me. We really need to get an 0.6 release out there. (a hint for Chuck...) -- - Geoff Talvola gtalvola@NameConnector.com |
From: Keith F I. <kir...@ho...> - 2001-08-09 21:03:19
|
> >HTTPRequest, I can't see a way to do this, something similar to java's > >request.setAttribute("name", value). I think the java implementation of > >all this has a dictionary for "attributes" and one for "parameters". Does > >webware not? > In Webware CVS, we've added HTTPRequest.setField(). Combine that with > Application.forward() and/or Application.includeURL() to pass control to > another servlet and you've got what you want. Ah, excellent. I was wondering if you might want to add another dictionary called "attributes" to distinguish the data from form data (as you do with cookies), but this makes things easier. > So, grab a snapshot from CVS. The tip seems very stable to me. Okay. Soon as I get enough working code to get a sense of everything, I'll do that. Helpful to look at before asking questions, anyway. :) > We really need to get an 0.6 release out there. (a hint for Chuck...) Yes. BTW, how about a session.invalidate? Is that in CVS yet? I'm just about to start writing an app folks have to log in to, and it's SO nice to be able to do session.invalidate to log folks out. (And testing is impossible if my sessions never time out.) Keith |
From: Geoff T. <gta...@na...> - 2001-08-09 21:10:15
|
At 02:02 PM 8/9/01 -0700, Keith F Irwin wrote: >BTW, how about a session.invalidate? Is that in CVS yet? I'm just about >to start writing an app folks have to log in to, and it's SO nice to be >able to do session.invalidate to log folks out. (And testing is >impossible if my sessions never time out.) I use session.values().clear() to clear out the session. Works fine for me. We should probably add this as a session.invalidate() method. Is that the best name? What about session.clear()? -- - Geoff Talvola gtalvola@NameConnector.com |
From: Keith F I. <kir...@ho...> - 2001-08-09 22:09:31
|
On Thu, 9 Aug 2001, Geoff Talvola wrote: > At 02:02 PM 8/9/01 -0700, Keith F Irwin wrote: > >BTW, how about a session.invalidate? Is that in CVS yet? I'm just about > >to start writing an app folks have to log in to, and it's SO nice to be > >able to do session.invalidate to log folks out. (And testing is > >impossible if my sessions never time out.) > I use session.values().clear() to clear out the session. Works fine for me. yeah, I'll use that. > We should probably add this as a session.invalidate() method. Is that the > best name? What about session.clear()? all I know is that java has a session.invalidate(), and the best thing about webware so far is that it matches up well enough with java that extensive documentation isn't needed. Plus, session.invalidate is already defined as part of the API... -K |
From: Keith F I. <kir...@ho...> - 2001-08-09 23:20:22
|
On Thu, 9 Aug 2001, Geoff Talvola wrote: > >BTW, how about a session.invalidate? Is that in CVS yet? I'm just about > >to start writing an app folks have to log in to, and it's SO nice to be > >able to do session.invalidate to log folks out. (And testing is > >impossible if my sessions never time out.) > I use session.values().clear() to clear out the session. Works fine for me. Okay, I don't think this will work for my purposes. What I want to be able to do is test on session.isNew(). If true, I want to rediret the user to a login page. If not, I handle the request. When a logged in user logs out, I want the session to be "isNew()" again. I can't even get the session to be "new" by killing AppServer! Very odd. Keith > > We should probably add this as a session.invalidate() method. Is that the > best name? What about session.clear()? > > > -- > > - Geoff Talvola > gtalvola@NameConnector.com > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > http://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: Geoff T. <gta...@me...> - 2001-08-10 01:58:28
|
At 04:20 PM 8/9/2001 -0700, Keith F Irwin wrote: >On Thu, 9 Aug 2001, Geoff Talvola wrote: > > > >BTW, how about a session.invalidate? Is that in CVS yet? I'm just about > > >to start writing an app folks have to log in to, and it's SO nice to be > > >able to do session.invalidate to log folks out. (And testing is > > >impossible if my sessions never time out.) > > > I use session.values().clear() to clear out the session. Works fine > for me. > >Okay, I don't think this will work for my purposes. What I want to be >able to do is test on session.isNew(). If true, I want to rediret the >user to a login page. If not, I handle the request. When a logged in >user logs out, I want the session to be "isNew()" again. > >I can't even get the session to be "new" by killing AppServer! Very odd. > >Keith You can just code your servlets so that they don't need to know whether the session is really "new" or if it has just had all of its values cleared out. I have session variables that I set when the user logs in. So I just test for those variables, and if they are not there, I go to the login page. It looks vaguely like this: loggedIn = self.session().value('loggedIn', 0) if not loggedIn: # Do the work of logging the user in ... self.session().setValue('loggedIn', 1) instead of using the session object's isNew() method. We really ought to implement invalidate() for real though. - Geoff |
From: Chuck E. <Chu...@ya...> - 2001-08-10 14:00:47
|
At 02:02 PM 8/9/2001 -0700, Keith F Irwin wrote: > > >HTTPRequest, I can't see a way to do this, something similar to java's > > >request.setAttribute("name", value). I think the java implementation of > > >all this has a dictionary for "attributes" and one for "parameters". Does > > >webware not? > > > In Webware CVS, we've added HTTPRequest.setField(). Combine that with > > Application.forward() and/or Application.includeURL() to pass control to > > another servlet and you've got what you want. > >Ah, excellent. I was wondering if you might want to add another >dictionary called "attributes" to distinguish the data from form data (as >you do with cookies), but this makes things easier. Actually, it is there! Both request and response ultimately inherit from "Message" which has an API for manipulating an arbitrary dictionary of arguments. See WebKit/Message.py, or even: http://webware.sourceforge.net/Webware/WebKit/Docs/Source/Summaries/Message.py.html I created this for the obvious reasons, but wondered if anyone would ever use it. Now that you know about it, will you stick with setField() or use these methods? I was silently contemplating killing off the ## Arguments ## section of Message.py since they seemed unused. -Chuck |
From: Keith F I. <kir...@ho...> - 2001-08-11 04:10:46
|
>>>> Generic "args" for Request object and/or a setField method. > Actually, it is there! Both request and response ultimately inherit from > "Message" which has an API for manipulating an arbitrary dictionary of > arguments. See WebKit/Message.py, or even: > I created this for the obvious reasons, but wondered if anyone would ever > use it. Now that you know about it, will you stick with setField() or use > these methods? I was silently contemplating killing off the ## Arguments ## > section of Message.py since they seemed unused. Chuck-- I'm hereby using it. I think it needs to be publicized a bit more, especially in your paper, the overview of the Webware system. The thing about object oriented stuff.... if you don't know there are methods you can use in a superclass, how do you ever find out except looking at the code? I looked at Message.py a few times, but only when seeing how I could get session.invalidate() working, and missed that args stuff completely. Ah well. I just glad it's there. Very useful for an object passing fiend like me. :) Keith > > > -Chuck > > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > http://lists.sourceforge.net/lists/listinfo/webware-discuss |
From: Chuck E. <Chu...@ya...> - 2001-08-11 12:34:09
|
At 09:10 PM 8/10/2001 -0700, Keith F Irwin wrote: >Chuck-- > >I'm hereby using it. I think it needs to be publicized a bit more, >especially in your paper, the overview of the Webware system. > >The thing about object oriented stuff.... if you don't know there are >methods you can use in a superclass, how do you ever find out except >looking at the code? You also look at the summaries, which are provided upon installation. Here is the class hierarchy, and on the left you will see links to the summaries: http://webware.sourceforge.net/Webware/WebKit/Docs/Source/ClassHier.html OOP is nice, but it does require that you familiarize yourself with the ancestor classes. -Chuck |