Hello,
I'm currently have 2 ideas and ... no idea, how to handle it... 1.) I would like to save a database connection into the session. How that would be done is known, but I want to close the connection in the case, the session is closed. Does someone know, which method should be overwritten in this case? 2.) I want to display an image (picture) to the user, only in the case, the user is logged in. And this image is - for security reasons - not accessible through a normal http-get. It is saved in another path. To achieve this, I think I need access to the session, which means for me, I need a class, subclassed from Widget (e.g.). But I currently have no idea, how to stream the image-content than to the user... Would be nice, if you could help me out! Thanks in advance. Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Le lundi 22 juin 2009 à 11:22 +0200, Joachim Jaeckel a écrit :
> Hello, > > I'm currently have 2 ideas and ... no idea, how to handle it... > > 1.) I would like to save a database connection into the session. How > that would be done is known, but I want to close the connection in the > case, the session is closed. Does someone know, which method should be > overwritten in this case? You should probably subclass Iliad.Session, then use it in the SessionManager: Iliad.SessionManager sessionClass: MySession Then in your session subclass, you can add your code in the #expire method. > > 2.) I want to display an image (picture) to the user, only in the case, > the user is logged in. And this image is - for security reasons - not > accessible through a normal http-get. It is saved in another path. To > achieve this, I think I need access to the session, which means for me, > I need a class, subclassed from Widget (e.g.). But I currently have no > idea, how to stream the image-content than to the user... > Unfortunately, there is currently no easy way to do that if your image isn't in the Public directory. You can have a look at Core/RequestHandlers/FileHandler.st, but I'll try to provide a better answer soon. Cheers! Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
Hi Nico,
> You should probably subclass Iliad.Session, then use it in the > SessionManager: Iliad.SessionManager sessionClass: MySession *mmmmhhh* I would need an additional bit of help... I tried it with: Iliad.SessionManager current sessionClass: UrPicsSession. Iliad.SessionManager current newSession. in my Application>>initialize method. I got no errors, but if I try afterwards a self session userLoggedIn: false. (I have a new variable and the needed accessors) it fails, with the message that Iliad.Session does not understand userLoggedIn: Maybe I have to connect the new created session to the application? (Or maybe the point, where I create the session is not correct?) Thanks in advance, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Le lundi 22 juin 2009 à 17:50 +0200, Joachim Jaeckel a écrit :
> I tried it with: > Iliad.SessionManager current sessionClass: UrPicsSession. > Iliad.SessionManager current newSession. > > in my Application>>initialize method. Sorry, I don't know how, but I missed that part... You can't change the session class from an instance of application, because the application lives within the the session context. You have to do it from the outside of the application. Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
Thanks a lot Nicolas!
The session is correctly handled! :-) Thanks again for your support! It's great. Everything is working! Now I'll start with the datbase connection. As I see it correctly, there is only one type of session for the whole vm, isn't it? Do you think (currently it's not neccessary for me, but maybe for other installations...) it would be possible in the future, to configure a session class for a specific application? (Even though, I think there would be not a great differences in the session-types... The reason, why I need a special Session, is a database-connection, which should be closed, if the session is closed. Other data could go into the preferences of the session...) Otherwise, the general database-connection could also go as an class-variable into the application... How do you handle database-connections with Iliad in your Applications? (In my perl-framework, I use a db-connection for every request, but I was thinking about using a connection pooling...) But let me note another thing: I have sometimes with my login-dialog the phänomenon, that I get the "Object: nil error: did not understand 'anyDataReady" This comes up, with or without the special Session class, and even in the old-code (I think it was revision 1342 that I was using before today). Not every time I press the save or cancel button in this dialog, only sometimes. (Mostly if I click several times on the forget_password link and than on one of the save or cancel button. Currently it seems to me, that everything is working as expected, even if this error is thrown, but maybe someone would like to have a look into it... Thanks again and best regards, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Le lundi 22 juin 2009 à 23:49 +0200, Joachim Jaeckel a écrit :
> Thanks a lot Nicolas! > > The session is correctly handled! :-) > > Thanks again for your support! You're welcome :) > > It's great. Everything is working! > > Now I'll start with the datbase connection. > > As I see it correctly, there is only one type of session for the whole > vm, isn't it? Yes, that's right. > > Do you think (currently it's not neccessary for me, but maybe for other > installations...) it would be possible in the future, to configure a > session class for a specific application? It's not planned. The main reason is that the Session class itself can be extended with the #preference* methods. Another reason is that I don't need it ;) But now that you ask, I think this could be a preference of Application, so each application could set a special session class if needed. > (Even though, I think there would be not a great differences in the > session-types... The reason, why I need a special Session, is a > database-connection, which should be closed, if the session is closed. > Other data could go into the preferences of the session...) > > Otherwise, the general database-connection could also go as an > class-variable into the application... > > How do you handle database-connections with Iliad in your Applications? > (In my perl-framework, I use a db-connection for every request, but I > was thinking about using a connection pooling...) > class, else I really like SandstoneDb. I'm not a big fan of relational databases. If I have to use one, I like to use ROE or GLORP to make the OR mapping for me. (BTW, I have an early port of SandstoneDb here, in case someone is interested, I could share it). > But let me note another thing: > > I have sometimes with my login-dialog the phänomenon, that I get the > "Object: nil error: did not understand 'anyDataReady" > > This comes up, with or without the special Session class, and even in > the old-code (I think it was revision 1342 that I was using before > today). Not every time I press the save or cancel button in this dialog, > only sometimes. (Mostly if I click several times on the forget_password > link and than on one of the save or cancel button. > > Currently it seems to me, that everything is working as expected, even > if this error is thrown, but maybe someone would like to have a look > into it... This bug doesn't seem to be related to Iliad, but to Swazoo. There is also another annoying bug with multipart forms... Cheers! Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
>> Thanks again for your support!
> > You're welcome :) Really thanks! > But now that you ask, I think this could be a preference of Application, > so each application could set a special session class if needed. I think, this could be a good idea, if you have the case that you run several Iliad Applications on your server... > (BTW, I have an early port of SandstoneDb here, in case someone is > interested, I could share it). SandstoneDb sounds indeed interesting, I already read about it. And there exists also a Goods-Database connector for it. But I'm used to use relational DB's. So that's something that I'm comfortable with... (In my current Java Project, we use JPA, so Glorp might be a good counterpart, but otherwise, I have some knowledge of perl, so DBI is also known by me. Which is the reason why I decide to use the DBI interface of gst). > I experienced it too. > > This bug doesn't seem to be related to Iliad, but to Swazoo. There is > also another annoying bug with multipart forms... It's nice to hear, that not only I discover this behaviour :-) I was not able to figure out, where this error is related to. Best regards, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Nicolas Petton
Le mardi 23 juin 2009 à 00:26 +0200, Nicolas Petton a écrit :
> Le lundi 22 juin 2009 à 23:49 +0200, Joachim Jaeckel a écrit : > > Thanks a lot Nicolas! > > > > The session is correctly handled! :-) > > > > Thanks again for your support! > > You're welcome :) > > > > > It's great. Everything is working! > > > > Now I'll start with the datbase connection. > > > > As I see it correctly, there is only one type of session for the whole > > vm, isn't it? > > Yes, that's right. > > > > > Do you think (currently it's not neccessary for me, but maybe for other > > installations...) it would be possible in the future, to configure a > > session class for a specific application? > > It's not planned. The main reason is that the Session class itself can > be extended with the #preference* methods. Another reason is that I > don't need it ;) > > But now that you ask, I think this could be a preference of Application, > so each application could set a special session class if needed. In fact, Iliad is kind of designed to run one app at the time (per vm), similar to RubyOnRails (even if it's not completely true). That's how I always deployed my web apps, so it was natural for me to make Iliad work this way. Of course you can have several apps, as there are several examples running when you load Iliad-More-Examples package, but for instance they share the same Public directory. The problem is that you may want to use different applications, with different paths, for a given web app. Let's say you have an app for user management, and another one for something else. In this scenario, you want to keep your session when going from one app to the another one, so you can't set different session classes for each app. Cheers! Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
> In fact, Iliad is kind of designed to run one app at the time (per vm),
> similar to RubyOnRails (even if it's not completely true). > > That's how I always deployed my web apps, so it was natural for me to > make Iliad work this way. > > Of course you can have several apps, as there are several examples > running when you load Iliad-More-Examples package, but for instance they > share the same Public directory. > > The problem is that you may want to use different applications, with > different paths, for a given web app. Let's say you have an app for user > management, and another one for something else. In this scenario, you > want to keep your session when going from one app to the another one, so > you can't set different session classes for each app. Ah, ok. No problem. I think, this should only be known. (Don't know, if that was so clear to the other's.) Maybe this is something for the Documentation of the Iliad web-site? Best regards, Joachim. _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |