Re: onSessionEnd not working as expected
Dan, Thanks (belatedly) this worked. Jerry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345602 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
Jerry, On Fri, Jun 17, 2011 at 11:55 AM, Gerald Weir wrote: > > First, my apologies to all if this is a duplicate post. I seem to be having > trouble posting. Anyway, > > Hello All, > > Thanks for your input. Ray, you are correct in that I needed to pass in the > session scope variables correctly. > > In my original post it is clear that a) I was not passing in the session > scope vars (the array) correctly; and b) I had not indicated the path > correctly. Now I've fixed those items and am mostly successful as in the > following: > > > > > > method="writeJobStepArray" returnvariable="isSuccess"> > value="#Arguments.SessionScope.jobStepArray#"> > > > > > > > > I had tried the / paths because it had appeared to me that the onSessionEnd > was not finding the component but what I see now is that there is an error > in the CFC regarding an application scope variable that I had not seen so > naturally it was erroring out - not that it couldn't find the cfc. > > I definitely learned a lot about using CFLOG for debugging in this one. > But, there is one other small issue and that is I tried to pass in the > application scope var as follows and it didn't seem to work (so I've > hard-coded for the time being): > > In application.cfc I have defined a datasource structure: > application.database = structNew() > > The database is: application.database.dsn > > I tried to pass this to the CFC in onSessionEnd like this: > > value="#Arguments.ApplicationScope.application.database.dsn#"> > > ...but it didn't work. What is the correct syntax for this? > > You'd only need: -Dan -- Dan G. Switzer, II dswit...@pengoworks.com http://blog.pengoworks.com/ âââââââ ââ âââââ âââââââ â âââ â âââââ ââ â âââ â â âââ â ââ â âââ â âââ â âââââââ âââ â â â âââââââ ââââââââ âââââ âââââ âââ ââââââââââââââ âââââ ââ ââââââââââââââ âââââ ââââ ââ ââ â ââââââââ âââââââ ââ ââ â ââ âââ ââââââââ â âââââââ âââ âââââ â âââââ â âââ â âââ ââ ââââââ ââ â âââ â â ââ ââ âââ âââ â âââââââ ââ ââ ââ â ââ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345399 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
First, my apologies to all if this is a duplicate post. I seem to be having trouble posting. Anyway, Hello All, Thanks for your input. Ray, you are correct in that I needed to pass in the session scope variables correctly. In my original post it is clear that a) I was not passing in the session scope vars (the array) correctly; and b) I had not indicated the path correctly. Now I've fixed those items and am mostly successful as in the following: I had tried the / paths because it had appeared to me that the onSessionEnd was not finding the component but what I see now is that there is an error in the CFC regarding an application scope variable that I had not seen so naturally it was erroring out - not that it couldn't find the cfc. I definitely learned a lot about using CFLOG for debugging in this one. But, there is one other small issue and that is I tried to pass in the application scope var as follows and it didn't seem to work (so I've hard-coded for the time being): In application.cfc I have defined a datasource structure: application.database = structNew() The database is: application.database.dsn I tried to pass this to the CFC in onSessionEnd like this: ...but it didn't work. What is the correct syntax for this? Many thanks to all Jerry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345398 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: onSessionEnd not working as expected
The answer is in your own post, but as you don't share the code for onSessinEnd() and don't tells us what error you are getting then it makes it hard to help. On the surface, what is the problem. Is it that when you put the component in a directory it doesn't work or what? But if this is the case then it sounds like a path issue. Regards, Andrew Scott http://www.andyscott.id.au/ > -Original Message- > From: Gerald Weir [mailto:g.w...@projectsinknowledge.com] > Sent: Thursday, 16 June 2011 1:31 AM > To: cf-talk > Subject: onSessionEnd not working as expected > > > I have read many posts by people who have problems with onSessionEnd. > This is my first conversion of application.cfm to application.cfc and the > onSessionEnd is not working with the CFFunction I am trying to invoke. > > I guess what's hanging this up is how to properly call the component from the > /lib/components/ folder where it resides. > > When a user logs in I am creating a session array that tracks a jobNumber and > the last_completed_step in that job. There are multiple jobs in a users > session. At the end of the session I want to write the updated array data > back to the DB. > > I should make it clear that at present I look into my log file and see that the > session is started - as coded in the onSessionStart shown below. > Furthermore, the onSessionEnd also writes to the log file when I take out the > invocation of the component. In other words if I just tell it to write "Session > ended." to the log file I will see it in the log file. I have set current session > timeout in CF Administrator and my app.cfc for 3 minutes for testing. > > If I call the "giveMeAnswer" method in the jobState.cfc from a separate file > (also at the root level) the giveMeAnswer method works properly and > returns the value "I am a CFC." > > If I move the jobState.cfc to the root level and set the component attribute > to "jobState" I am also getting a return from the component. > > returnType="void" output="false"> > > >component="#application.virtualPaths.cfcPath#system/sessionVars" > method="init" /> > > > > > > > > >/> >required="true" /> > >method="giveMeAnswer" returnvariable="returnFromCfc"> > > > > > > > > > So, is it just not finding the component/method? Any other ideas? > > Thanks much, Jerry > > ~~ > ~~~| > Order the Adobe Coldfusion Anthology now! > http://www.amazon.com/Adobe-Coldfusion- > Anthology/dp/1430272155/?tag=houseoffusion > Archive: http://www.houseoffusion.com/groups/cf- > talk/message.cfm/messageid:345334 > Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm > Unsubscribe: http://www.houseoffusion.com/groups/cf- > talk/unsubscribe.cfm ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345361 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
On Wed, Jun 15, 2011 at 9:19 AM, Raymond Camden wrote: > If you are using session.ANYTHING, you will get an error. In > onSessionEnd, you must use the Session scope as it is passed in as n > argument. So arguments.sessionData.whatever instead of > session.whatever. What Ray said: session scope has gone by the time onSessionEnd() is called. Also note that you do not have access to request scope at that point, nor CGI and a bunch of other things. onSessionEnd() is invoked "outside" the normal request machinery. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345356 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
If you are using session.ANYTHING, you will get an error. In onSessionEnd, you must use the Session scope as it is passed in as n argument. So arguments.sessionData.whatever instead of session.whatever. On Wed, Jun 15, 2011 at 11:17 AM, Gerald Weir wrote: > > Just for testing I moved my CFC with the "real" code to write the > session.array to the database up to the root level so that I could identify > the component as component="jobState". That way I could test the CFC itself > without worrying about the location. > > So, calling the real component/method that is successful when called from a > test file appears to fail somehow and the end of session record is not > written to the log file. > > Is it possible that since I'm in the onSessionEnd and the SessionScope must > be passed to it that the session.jobStepArray that exists for the user is not > available to the cfc that wants to write it? > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345342 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
Just for testing I moved my CFC with the "real" code to write the session.array to the database up to the root level so that I could identify the component as component="jobState". That way I could test the CFC itself without worrying about the location. So, calling the real component/method that is successful when called from a test file appears to fail somehow and the end of session record is not written to the log file. Is it possible that since I'm in the onSessionEnd and the SessionScope must be passed to it that the session.jobStepArray that exists for the user is not available to the cfc that wants to write it? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345340 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
I'd love to say I planned that. ;) On Wed, Jun 15, 2011 at 11:04 AM, Dave Watts wrote: > >> You asked this on SackOverflow as well. > > I just want to state for the record that I enjoyed this typo. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > http://training.figleaf.com/ > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > GSA Schedule, and provides the highest caliber vendor-authorized > instruction at our training centers, online, or onsite. > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345339 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
> You asked this on SackOverflow as well. I just want to state for the record that I enjoyed this typo. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345338 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: onSessionEnd not working as expected
You asked this on SackOverflow as well. I'll repeat my answer. I know I've seen folks use / in component calls before, but I do not believe it is officially supported. You want to use a dot notation path instead, ala component="lib.components.jobstate" and assure that lib is either a subdirectory or a known CF mapping that points to the lib folder. On Wed, Jun 15, 2011 at 10:31 AM, Gerald Weir wrote: > > I have read many posts by people who have problems with onSessionEnd. This > is my first conversion of application.cfm to application.cfc and the > onSessionEnd is not working with the CFFunction I am trying to invoke. > > I guess what's hanging this up is how to properly call the component from the > /lib/components/ folder where it resides. > > When a user logs in I am creating a session array that tracks a jobNumber and > the last_completed_step in that job. There are multiple jobs in a users > session. At the end of the session I want to write the updated array data > back to the DB. > > I should make it clear that at present I look into my log file and see that > the session is started - as coded in the onSessionStart shown below. > Furthermore, the onSessionEnd also writes to the log file when I take out the > invocation of the component. In other words if I just tell it to write > "Session ended." to the log file I will see it in the log file. I have set > current session timeout in CF Administrator and my app.cfc for 3 minutes for > testing. > > If I call the "giveMeAnswer" method in the jobState.cfc from a separate file > (also at the root level) the giveMeAnswer method works properly and returns > the value "I am a CFC." > > If I move the jobState.cfc to the root level and set the component attribute > to "jobState" I am also getting a return from the component. > > > > > > component="#application.virtualPaths.cfcPath#system/sessionVars" > method="init" /> > > > > > > > > > > > > returnvariable="returnFromCfc"> > > > > > > > > > So, is it just not finding the component/method? Any other ideas? > > Thanks much, Jerry > > ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345336 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
onSessionEnd not working as expected
I have read many posts by people who have problems with onSessionEnd. This is my first conversion of application.cfm to application.cfc and the onSessionEnd is not working with the CFFunction I am trying to invoke. I guess what's hanging this up is how to properly call the component from the /lib/components/ folder where it resides. When a user logs in I am creating a session array that tracks a jobNumber and the last_completed_step in that job. There are multiple jobs in a users session. At the end of the session I want to write the updated array data back to the DB. I should make it clear that at present I look into my log file and see that the session is started - as coded in the onSessionStart shown below. Furthermore, the onSessionEnd also writes to the log file when I take out the invocation of the component. In other words if I just tell it to write "Session ended." to the log file I will see it in the log file. I have set current session timeout in CF Administrator and my app.cfc for 3 minutes for testing. If I call the "giveMeAnswer" method in the jobState.cfc from a separate file (also at the root level) the giveMeAnswer method works properly and returns the value "I am a CFC." If I move the jobState.cfc to the root level and set the component attribute to "jobState" I am also getting a return from the component. So, is it just not finding the component/method? Any other ideas? Thanks much, Jerry ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345334 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm