RE: [ACFUG Discuss] Multiple Application.CFC files

2008-05-23 Thread Dusty Hale
I haven't tried this with Application.cfc but this does work in
Application.cfm so I assume it would work. Just use one app file and put
some code like this in it:






Do login routine



I just tried it and seems to do what you describe.

-Dusty 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Clarke Bishop
Sent: 05/23/2008 6:53 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] Multiple Application.CFC files

In my webroot, I am trying to setup a secure directory where a login is
required. I got some good ideas the other day from Doug, but I'm still
having trouble.

Here's what I'm trying to do

/webroot/
   accessibleStuff.cfm
   /secure/
  stuffThatRequiresLogin.cfm

So, anything in the secure directory requires a login.

Now, I've got an Application.cfc in my webroot. All, I have to do, is put
another Application.cfc in the secure directory and check for login.

Problem 1.

CF only processes one Application.cfc. So, when I add the second
Application.cfc, all my session initialization, error handling, etc. in
webroot.Application doesn't run. 

I think the answer to this is to make the second Application.cfc extend
webroot.Application, but maybe there's a better way.

Problem 2.

When I did have the second Application.cfc extend webroot.Application, cfm
pages in the secure directory don't fire the OnSessionStart event located in
webroot.Application.

My plan was to test the value of SESSION.IsLoggedIn, but it's failing
because IsLoggedIn did not get initialized by OnSessionStart.

What am I missing? Is there a better way to do this?

Thanks,

Clarke





-
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists Archive @
http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-






-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-





Re: [ACFUG Discuss] Multiple Application.CFC files

2008-05-23 Thread Douglas Knudsen
Clarke, yup, should be able to just extend the root Application.cfc with the
one(s) below to get all that 'inheritance' goodness.  One thing though is a
little issue with CF in this regard.  You can't extend the root
Applicaiton.cfc do to some pathing thing.  To get around this though you can
create a proxy.  You can read all about it on that CF super hero's blog
http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_Applicationcfc

Also, Ray Camden has a great write up using this Application.cfc animal
http://www.coldfusionjedi.com/index.cfm/2007/11/9/Applicationcfc-Methods-and-Example-Uses

DK


On Fri, May 23, 2008 at 6:53 PM, Clarke Bishop <[EMAIL PROTECTED]>
wrote:

> In my webroot, I am trying to setup a secure directory where a login is
> required. I got some good ideas the other day from Doug, but I'm still
> having trouble.
>
> Here's what I'm trying to do
>
> /webroot/
>   accessibleStuff.cfm
>   /secure/
>  stuffThatRequiresLogin.cfm
>
> So, anything in the secure directory requires a login.
>
> Now, I've got an Application.cfc in my webroot. All, I have to do, is put
> another Application.cfc in the secure directory and check for login.
>
> Problem 1.
>
> CF only processes one Application.cfc. So, when I add the second
> Application.cfc, all my session initialization, error handling, etc. in
> webroot.Application doesn't run.
>
> I think the answer to this is to make the second Application.cfc extend
> webroot.Application, but maybe there's a better way.
>
> Problem 2.
>
> When I did have the second Application.cfc extend webroot.Application, cfm
> pages in the secure directory don't fire the OnSessionStart event located
> in
> webroot.Application.
>
> My plan was to test the value of SESSION.IsLoggedIn, but it's failing
> because IsLoggedIn did not get initialized by OnSessionStart.
>
> What am I missing? Is there a better way to do this?
>
> Thanks,
>
>Clarke
>
>
>
>
>
> -
> To unsubscribe from this list, manage your profile @
> http://www.acfug.org?fa=login.edituserform
>
> For more info, see http://www.acfug.org/mailinglists
> Archive @ http://www.mail-archive.com/discussion%40acfug.org/
> List hosted by http://www.fusionlink.com
> -
>
>
>
>


-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?



-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



RE: [ACFUG Discuss] Multiple Application.CFC files

2008-05-29 Thread Clarke Bishop
Thanks Dusty and Doug for your thoughts last week. Also, I wanted to report
back on what I ended up with as I think it's working really well now.
 
What I ended up with is:
 
/webroot/
  Application.cfc
  accessibleStuff.cfm

  /secure/
 Application.cfc
 stuffThatRequiresLogin.cfm
 
I think I needed to stop and restart the server when I wrote the previous
message, because this is working and making sense now. 
 
I added one thing to the onSessionStart method of the
webroot/Application.cfc:
 
  SESSION.isLoggedIn = False
 
This, of course initializes the isLoggedIn value when the session first
starts.
 
I have other stuff that runs in webroot/Application.cfc methods/events, and
I didn't want to mess that up or complicate it.
 
So, I added another Application.cfc in webroot/secure/Application.cfc. The
second Application.cfc was setup to extend the one in the webroot. 
Just add extends="Application" (where Application includes the full path to
the CFC) as a parameter in the  tag.
 
Then add an onRequestStart method the the second Application.cfc which
overrides the method in webroot/Application.cfc. And in that method, all I
do is:
 



 
So any request for a page in my /secure/ directory gets automatically
checked to see if the user is logged in, and if not, they get redirected.
The login.cfm page is up a level from the /secure/ directory, so it doesn't
get checked for login or redirected.
 
A lot of you may know how to do all this, but I have been very pleased with
how clean and straightforward it is. So, just in case, I wanted to tell
everyone.
 
Thanks again for the help!
 
 Clarke

  _  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen
Sent: Saturday, May 24, 2008 1:07 AM
To: discussion@acfug.org
Subject: Re: [ACFUG Discuss] Multiple Application.CFC files


Clarke, yup, should be able to just extend the root Application.cfc with the
one(s) below to get all that 'inheritance' goodness.  One thing though is a
little issue with CF in this regard.  You can't extend the root
Applicaiton.cfc do to some pathing thing.  To get around this though you can
create a proxy.  You can read all about it on that CF super hero's blog
http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_A
pplicationcfc

Also, Ray Camden has a great write up using this Application.cfc animal
http://www.coldfusionjedi.com/index.cfm/2007/11/9/Applicationcfc-Methods-and
-Example-Uses

DK



On Fri, May 23, 2008 at 6:53 PM, Clarke Bishop <[EMAIL PROTECTED]>
wrote:


In my webroot, I am trying to setup a secure directory where a login is
required. I got some good ideas the other day from Doug, but I'm still
having trouble.

Here's what I'm trying to do

/webroot/
  accessibleStuff.cfm
  /secure/
 stuffThatRequiresLogin.cfm

So, anything in the secure directory requires a login.

Now, I've got an Application.cfc in my webroot. All, I have to do, is put
another Application.cfc in the secure directory and check for login.

Problem 1.

CF only processes one Application.cfc. So, when I add the second
Application.cfc, all my session initialization, error handling, etc. in
webroot.Application doesn't run.

I think the answer to this is to make the second Application.cfc extend
webroot.Application, but maybe there's a better way.

Problem 2.

When I did have the second Application.cfc extend webroot.Application, cfm
pages in the secure directory don't fire the OnSessionStart event located in
webroot.Application.

My plan was to test the value of SESSION.IsLoggedIn, but it's failing
because IsLoggedIn did not get initialized by OnSessionStart.

What am I missing? Is there a better way to do this?

Thanks,

   Clarke





-
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-








-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it? 
- 
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform 

For more info, see http://www.acfug.org/mailinglists 
Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink <http://www.fusionlink.com>  
- 



-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-



Re: [ACFUG Discuss] Multiple Application.CFC files

2008-05-30 Thread Steven Ross
Extending CFC's is great, use it all the time for creating Base CFC's for
DAO, Beans, and Gateways. Easy way to add common functionality to existing
cfc's throughout the development of your app.

On Thu, May 29, 2008 at 9:43 PM, Clarke Bishop <[EMAIL PROTECTED]>
wrote:

>  Thanks Dusty and Doug for your thoughts last week. Also, I wanted to
> report back on what I ended up with as I think it's working really well now.
>
> What I ended up with is:
>
> /webroot/
>   Application.cfc
>   accessibleStuff.cfm
>
>   /secure/
>  Application.cfc
>  stuffThatRequiresLogin.cfm
>
> I think I needed to stop and restart the server when I wrote the previous
> message, because this is working and making sense now.
>
> I added one thing to the onSessionStart method of the
> webroot/Application.cfc:
>
>   SESSION.isLoggedIn = False
>
> This, of course initializes the isLoggedIn value when the session first
> starts.
>
> I have other stuff that runs in webroot/Application.cfc methods/events, and
> I didn't want to mess that up or complicate it.
>
> So, I added another Application.cfc in webroot/secure/Application.cfc. The
> second Application.cfc was setup to extend the one in the webroot.
> Just add extends="Application" (where Application includes the full path
> to the CFC) as a parameter in the  tag.
>
> Then add an onRequestStart method the the second Application.cfc which
> overrides the method in webroot/Application.cfc. And in that method, all I
> do is:
>
> 
> 
> 
>
> So any request for a page in my /secure/ directory gets automatically
> checked to see if the user is logged in, and if not, they get redirected.
> The login.cfm page is up a level from the /secure/ directory, so it doesn't
> get checked for login or redirected.
>
> A lot of you may know how to do all this, but I have been very pleased with
> how clean and straightforward it is. So, just in case, I wanted to tell
> everyone.
>
> Thanks again for the help!
>
>  Clarke
>
>  ----------
> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Douglas
> Knudsen
> *Sent:* Saturday, May 24, 2008 1:07 AM
> *To:* discussion@acfug.org
> *Subject:* Re: [ACFUG Discuss] Multiple Application.CFC files
>
> Clarke, yup, should be able to just extend the root Application.cfc with
> the one(s) below to get all that 'inheritance' goodness.  One thing though
> is a little issue with CF in this regard.  You can't extend the root
> Applicaiton.cfc do to some pathing thing.  To get around this though you can
> create a proxy.  You can read all about it on that CF super hero's blog
>
> http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_Applicationcfc
>
> Also, Ray Camden has a great write up using this Application.cfc animal
>
> http://www.coldfusionjedi.com/index.cfm/2007/11/9/Applicationcfc-Methods-and-Example-Uses
>
> DK
>
>
> On Fri, May 23, 2008 at 6:53 PM, Clarke Bishop <[EMAIL PROTECTED]>
> wrote:
>
>> In my webroot, I am trying to setup a secure directory where a login is
>> required. I got some good ideas the other day from Doug, but I'm still
>> having trouble.
>>
>> Here's what I'm trying to do
>>
>> /webroot/
>>   accessibleStuff.cfm
>>   /secure/
>>  stuffThatRequiresLogin.cfm
>>
>> So, anything in the secure directory requires a login.
>>
>> Now, I've got an Application.cfc in my webroot. All, I have to do, is put
>> another Application.cfc in the secure directory and check for login.
>>
>> Problem 1.
>>
>> CF only processes one Application.cfc. So, when I add the second
>> Application.cfc, all my session initialization, error handling, etc. in
>> webroot.Application doesn't run.
>>
>> I think the answer to this is to make the second Application.cfc extend
>> webroot.Application, but maybe there's a better way.
>>
>> Problem 2.
>>
>> When I did have the second Application.cfc extend webroot.Application, cfm
>> pages in the secure directory don't fire the OnSessionStart event located
>> in
>> webroot.Application.
>>
>> My plan was to test the value of SESSION.IsLoggedIn, but it's failing
>> because IsLoggedIn did not get initialized by OnSessionStart.
>>
>> What am I missing? Is there a better way to do this?
>>
>> Thanks,
>>
>>Clarke
>>
>>
>>
>>
>>
>> -
>> To unsubscribe from this list, manage you