I have seen some intermitent behavior in CF 7.02 where the application.cfc seems to be ignored. So much so, I had to code a workaround in my ColdSpring remote façade to check for the existance of my application.serviceFactory and re-instantiate it if not available.
I have had no issues with CF8 in that regard. Moving away from the session scope is recommended - it's just too much of a pain to keep the client and server in sync. What I do use, that works great, is the setting the remote credentials in my remote objects (a piece of cake with Cairngorm ServierLocator) and using the CFLOGIN framework in the server-side to map the user to roles and using that to secure my remote object methods. That way timeout is not an issue - if the user's CFLOGIN goes out of scope, you simply re-create it using their credentials that will be coming over the wire. However, implementing that is a little tricky - not has clean as I would like. I believe Ray Camden and others have blogged about this. I know some might not like the implementation-specific nature of CFLOGIN, but it does work and it would certainly be possible to create a similar framework in other languages. I like it because it gets the job done. Jeff -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jeffry Houser Sent: Thursday, May 01, 2008 7:03 PM To: [email protected] Subject: Re: [flexcoders] SOT: ColdFusion backend for Flex, what the heck am i doing wrong... I thought that the application.cfc was ignored for Flex Remoting requests. I have no idea why I think that, though, especially since it is documented that "OnRequest" can interfere with Flex remoting requests. I'll add that, I think it's a very bad idea to have "Remote use" CFCs that rely on shared scope variables, such as session. Derrick Anderson wrote: > > > i see nothing in the CF community about this and since many here have > CF > for their back-end apps I figured I'd give it a try. > > I'm using CF7 standard on the backend and communicating to my CFC's > with > remote object. The problem I've had for months now is every now and > then the onApplicationStart and onSessionStart methods stop firing in my > Application.cfc when a Flex request comes in. It actually appears to > ignore the Application.cfc altogether. The reason I suspect this is > because none of my application or session variables exist in my CFC's > when this problem happens, aren't those functions supposed to fire > automatically? What would cause them not to? > > A restart of the server might fix it, might not- i never know until i > tinker with the CFC's and application.cfc file settings until it > magically starts working again. Then a few days later, it's back > again. The relevant parts of my application.cfc are pasted below- has > anyone ever seen behavior like this??? > > <cfcomponent > displayname="Application" > output="true" > hint="Handle the application."> > > <cfscript> > this.name <http://this.name> = "MyApp"; > this.applicationTimeout = createTimeSpan(1,0,0,0); > this.sessionmanagement = "yes"; > this.sessiontimeout = createTimeSpan(0,1,0,0); > this.scriptProtect = "all"; > </cfscript> > > <cffunction > name="OnApplicationStart" > access="public" > returntype="boolean" > output="false" > hint="Fires when the application is first created."> > > <cfscript> > application.portalDSN = "portal"; > application.sessions = 0; > </cfscript> > > <cflog file="#this.name# <http://this.name#>" > type="Information" > text="Application #this.name# <http://this.name#> Started"> > > <cfreturn true /> > </cffunction> > > <cffunction name="onSessionStart" output="false"> > <cfscript> > session.started = now(); > session.projectID = 0; > if(cgi.SERVER_NAME CONTAINS "local") > { > session.clientDSN = "clientBase"; > } > else > { > session.clientDSN = ListFirst(cgi.SERVER_NAME,"."); > } > </cfscript> > > <cfquery datasource="#application.portalDSN#" name="qGetClientID"> > SELECT clientID FROM clients WHERE folderName = <cfqueryparam > cfsqltype="cf_sql_varchar" value="#session.clientDSN#"> > </cfquery> > <cfset session.clientID = qGetClientID.clientID> > > <cflock scope="application" timeout="5" type="Exclusive"> > <cfset application.sessions = application.sessions + 1> > </cflock> > </cffunction> > -- Jeffry Houser Flex, ColdFusion, AIR AIM: Reboog711 | Phone: 1-203-379-0773 -- Adobe Community Expert <http://www.adobe.com/communities/experts/members/JeffryHouser.html> My Company: <http://www.dot-com-it.com> My Podcast: <http://www.theflexshow.com> My Blog: <http://www.jeffryhouser.com> ------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links

