1
votes

My application.cfc uses the OnRequestStart to check users are logged in

<cfif not isDefined("session.auth.isLoggedIn")>
  <cfinclude template="loginForm.cfm">
  <cfabort>
</cfif>

and this is mangling my attempts to use a gateway service which errors out with

Error invoking CFC for gateway watchInboundFiles: null {GATEWAYTYPE={FileWatcher},ORIGINATORID={},CFCMETHOD={onDelete},DATA={{FILENAME={C:\temp\New Text Document.txt},TYPE={DELETE}}},CFCPATH={F:\ColdFusion9\wwwroot\watch_dir.cfc},GATEWAYID={watchInboundFiles}}.

If I comment out the OnRequestSTart method the gateway works as expected.

Someone else ran into this before here and a solution is apparently to

add a new application.cfc which extended my original but overrode the onRequestStart() - which worked perfectly.

So how do I do that please?

2

2 Answers

2
votes

You could also add something to the application.cfc to see if the call is coming from the gateway. If so then skip the if block.

2
votes

To answer your question:

Your new Application.cfc will live in another directory but extend your original:

<cfcomponent extends="path.to.my.original.Application">

  <cffunction name="onRequestStart">
    <!--- No login code here --->
  </cffunction>

</cfcomponent>

All other functions are available as usual.

Hoep that helps! More info here.