Loading ...
Sorry, an error occurred while loading the content.
 

Fusebox Out of Web Root With No CF Admin Mapping

Expand Messages
  • jamjaxn
    Hi Folks, Is it possible to locate core files outside of the web root, without having to use a CF Administrator mapping? (I m okay with app-specific mappings.)
    Message 1 of 16 , Nov 16, 2012
      Hi Folks,

      Is it possible to locate core files outside of the web root, without having to use a CF Administrator mapping? (I'm okay with app-specific mappings.)

      (I'm using Application.cfc, FWIW.)

      Thanks,
      Jamie
    • sommers.steve@rocketmail.com
      You can create a directory right off your site root called fusebox5.
      Message 2 of 16 , Nov 16, 2012
        You can create a directory right off your site root called fusebox5.

        --- In fusebox5@yahoogroups.com, "jamjaxn" <jamiejaxon@...> wrote:
        >
        > Hi Folks,
        >
        > Is it possible to locate core files outside of the web root, without having to use a CF Administrator mapping? (I'm okay with app-specific mappings.)
        >
        > (I'm using Application.cfc, FWIW.)
        >
        > Thanks,
        > Jamie
        >
      • Peter Boughton
        ... Create an application specific mapping and find out!
        Message 3 of 16 , Nov 16, 2012
          > Is it possible to locate core files outside of the web root, 
          > without having to use a CF Administrator mapping? 
          > (I'm okay with app-specific mappings.)

          Create an application specific mapping and find out!
        • Jamie Jackson
          If I knew how to create an application-specific mapping from the very component that needs the mapping for its extends attribute, I would try it. However, I
          Message 4 of 16 , Nov 16, 2012
            If I knew how to create an application-specific mapping from the very component that needs the mapping for its "extends" attribute, I would try it. However, I don't know how.

            Application.cfm

            component extends="myMapping.fusebox5.Application" {
              // too late to set the mapping:
              this.mappings["/myMapping"] = "/my/path";
            }

            I might be misunderstanding something, but that's the part I don't know how to work around. Know what I mean?

            Thanks,
            Jamie

            On Fri, Nov 16, 2012 at 1:39 PM, Peter Boughton <boughtonp@...> wrote:
             

            > Is it possible to locate core files outside of the web root, 
            > without having to use a CF Administrator mapping? 
            > (I'm okay with app-specific mappings.)

            Create an application specific mapping and find out!


          • Peter Boughton
            ... Then put that information in the original post - show that you ve made an effort and are not just wanting people to do your work for you. Regarding your
            Message 5 of 16 , Nov 16, 2012
              >  but that's the part I don't know how to work around.

              Then put that information in the original post - show that you've made an effort and are not just wanting people to do your work for you.


              Regarding your problem: you cannot use application-specific mappings in extends (because the extends is evaluated before the App.cfc has linked itself to the application via a matching application.name; the app-specific mappings are not available at that stage).

              However, you don't need to use extends - you start Fusebox by including the fusebox5.cfm, in onRequest (or equivalent), and that include can use an application-specific mapping (which points to the fusebox directory).


            • Jamie Jackson
              Hmm, it seems like it wouldn t be a very straightforward conversion, since I m already overriding some of FB5 s Application.cfc methods overriddenMethod () {
              Message 6 of 16 , Nov 16, 2012
                Hmm, it seems like it wouldn't be a very straightforward conversion, since I'm already overriding some of FB5's Application.cfc methods

                overriddenMethod () {
                  // my stuff
                  super.overriddenMethod()
                }

                I'm right in thinking that these would need to be reworked, correct?

                Thanks,
                Jamie

                On Fri, Nov 16, 2012 at 2:13 PM, Peter Boughton <boughtonp@...> wrote:
                 

                >  but that's the part I don't know how to work around.

                Then put that information in the original post - show that you've made an effort and are not just wanting people to do your work for you.


                Regarding your problem: you cannot use application-specific mappings in extends (because the extends is evaluated before the App.cfc has linked itself to the application via a matching application.name; the app-specific mappings are not available at that stage).

                However, you don't need to use extends - you start Fusebox by including the fusebox5.cfm, in onRequest (or equivalent), and that include can use an application-specific mapping (which points to the fusebox directory).



              • Peter Boughton
                Ah, had forgotten about the overriding method - never bothered with that since it s just as easy to do a simple include. Anyway, you can probably make it work
                Message 7 of 16 , Nov 16, 2012
                  Ah, had forgotten about the overriding method - never bothered with that since it's just as easy to do a simple include.

                  Anyway, you can probably make it work with something like this:

                  function onApplicationStart()
                  {
                  ...
                  variables.fb = createObject("component","FuseboxMapping.Application").bleed(variables) />
                  fb.onApplicationStart(ArgumentCollection=Arguments);
                  }
                  function overriddenMethod()
                  {
                  // needed for each of onRequestStart,onRequest,onRequestEnd,onError
                  // even if no custom behaviour

                  fb.overriddenMethod(ArgumentCollection=Arguments);
                  }


                  Not tested that to verify if it works, but that's basically how the fusebox5.cfm does it, so if not exactly that it'll be along those lines.
                • Jamie Jackson
                  That s pretty clever. I think there s a snag, though: I tried it out, but from what I can tell, you can t use a mapping within the Application.cfc that defines
                  Message 8 of 16 , Nov 16, 2012
                    That's pretty clever.

                    I think there's a snag, though: I tried it out, but from what I can tell, you can't use a mapping within the Application.cfc that defines it.

                    If I dump expandPath("/myMapping"), it's just tacks that onto the current directory.

                    Maybe it's plain not be possible to both get FB out of the web root and not have a CF Admin mapping.

                    Thanks,
                    Jamie

                    On Fri, Nov 16, 2012 at 3:09 PM, Peter Boughton <boughtonp@...> wrote:
                     

                    Ah, had forgotten about the overriding method - never bothered with that since it's just as easy to do a simple include.

                    Anyway, you can probably make it work with something like this:

                    function onApplicationStart()
                    {
                    ...
                    variables.fb = createObject("component","FuseboxMapping.Application").bleed(variables) />
                    fb.onApplicationStart(ArgumentCollection=Arguments);
                    }
                    function overriddenMethod()
                    {
                    // needed for each of onRequestStart,onRequest,onRequestEnd,onError
                    // even if no custom behaviour

                    fb.overriddenMethod(ArgumentCollection=Arguments);
                    }


                    Not tested that to verify if it works, but that's basically how the fusebox5.cfm does it, so if not exactly that it'll be along those lines.


                  • Peter Boughton
                    ... Eh? That (should) work fine - it does in Railo. I downloaded the skeleton app and modified the Application.cfc like this:
                    Message 9 of 16 , Nov 17, 2012
                      > I think there's a snag, though: I tried it out, but from what I can tell,
                      > you can't use a mapping within the Application.cfc that defines it.
                      >
                      > If I dump expandPath("/myMapping"), it's just tacks that onto the current
                      > directory.

                      Eh?

                      That (should) work fine - it does in Railo.


                      I downloaded the skeleton app and modified the Application.cfc like this:


                      Only done a quick test, with Railo 3.3, but it appears to work.
                    • Jamie Jackson
                      Hi Peter, Maybe this is a difference between Railo and Adobe CF (9,0,1,274733). Would you mind running the following distilled test case, and see you get
                      Message 10 of 16 , Nov 19, 2012
                        Hi Peter,

                        Maybe this is a difference between Railo and Adobe CF (9,0,1,274733).

                        Would you mind running the following distilled test case, and see you get different results than I do? (You'll have to change the mapping path, obviously.)

                        For me, it doesn't seem to be able to find the mapping-based path to the component.


                        Thanks,
                        Jamie

                        On Sat, Nov 17, 2012 at 3:45 AM, Peter Boughton <boughtonp@...> wrote:
                         

                        > I think there's a snag, though: I tried it out, but from what I can tell,
                        > you can't use a mapping within the Application.cfc that defines it.
                        >
                        > If I dump expandPath("/myMapping"), it's just tacks that onto the current
                        > directory.

                        Eh?

                        That (should) work fine - it does in Railo.


                        I downloaded the skeleton app and modified the Application.cfc like this:


                        Only done a quick test, with Railo 3.3, but it appears to work.


                      • Jamie Jackson
                        Never mind, it seems that one needs to use the mappings within an app.cfc * function *(as you had it), in order for it to work. I ll play with this some more.
                        Message 11 of 16 , Nov 19, 2012
                          Never mind, it seems that one needs to use the mappings within an app.cfc function (as you had it), in order for it to work.

                          I'll play with this some more.

                          Thanks,
                          Jamie

                          On Mon, Nov 19, 2012 at 9:44 AM, Jamie Jackson <jamiejaxon@...> wrote:
                          Hi Peter,

                          Maybe this is a difference between Railo and Adobe CF (9,0,1,274733).

                          Would you mind running the following distilled test case, and see you get different results than I do? (You'll have to change the mapping path, obviously.)

                          For me, it doesn't seem to be able to find the mapping-based path to the component.


                          Thanks,
                          Jamie


                          On Sat, Nov 17, 2012 at 3:45 AM, Peter Boughton <boughtonp@...> wrote:
                           

                          > I think there's a snag, though: I tried it out, but from what I can tell,
                          > you can't use a mapping within the Application.cfc that defines it.
                          >
                          > If I dump expandPath("/myMapping"), it's just tacks that onto the current
                          > directory.

                          Eh?

                          That (should) work fine - it does in Railo.


                          I downloaded the skeleton app and modified the Application.cfc like this:


                          Only done a quick test, with Railo 3.3, but it appears to work.



                        • Jamie Jackson
                          Peter, your mods to get FB without a mapping are working for me. Thanks for that! However, there s one last thing for me to fix. My app
                          Message 12 of 16 , Nov 19, 2012
                            Peter, your mods to get FB without a mapping are working for me. Thanks for that!

                            However, there's one last thing for me to fix. My app code is out of the web root, in a directory "app," right next to fusebox5 (core files).

                            I suspect there's something I need to set FUSEBOX_APPLICATION_PATH, or something, in order to have the app work out of the web root. Here's what I tried, but it doesn't work. (I'm not sure what FUSEBOX_APPLICATION_PATH even does, because I get the same behavior with and without.)

                            For some reason, in the parsed wwwroot/parsed/c.home.cfm fuseaction, the fuse includes are pathed correctly, but the plugins are not.

                            Do you have any idea how to fix that?

                            Thanks again,

                            Jamie


                            On Sat, Nov 17, 2012 at 3:45 AM, Peter Boughton <boughtonp@...> wrote:
                             

                            > I think there's a snag, though: I tried it out, but from what I can tell,
                            > you can't use a mapping within the Application.cfc that defines it.
                            >
                            > If I dump expandPath("/myMapping"), it's just tacks that onto the current
                            > directory.

                            Eh?

                            That (should) work fine - it does in Railo.


                            I downloaded the skeleton app and modified the Application.cfc like this:


                            Only done a quick test, with Railo 3.3, but it appears to work.


                          • Peter Boughton
                            Yeah, that s a similar thing to extends - the mapping isn t available at that point. All the This.Special bits are effectively just variables inside the
                            Message 13 of 16 , Nov 19, 2012
                              Yeah, that's a similar thing to extends - the mapping isn't available at that point.

                              All the This.Special bits are effectively just variables inside the pseudo-constructor (the name of the code outside of any functions); they are not applied until the moment before the onXStart functions are called.

                              Just to re-iterate for clarity: there is an important distinction there versus "within an app.cfc function" - you can't just create any function in app.cfc for evaluating the mapping. It's a question of being called after the point when the values have taken effect, which occurs before the first of on(Application|Session|Request)Start but after the pseudo-constructor code has been executed.

                              Hopefully that makes sense?
                            • Jamie Jackson
                              Yup, got it now, thanks.
                              Message 14 of 16 , Nov 19, 2012
                                Yup, got it now, thanks.

                                On Mon, Nov 19, 2012 at 12:10 PM, Peter Boughton <boughtonp@...> wrote:
                                 

                                Yeah, that's a similar thing to extends - the mapping isn't available at that point.

                                All the This.Special bits are effectively just variables inside the pseudo-constructor (the name of the code outside of any functions); they are not applied until the moment before the onXStart functions are called.

                                Just to re-iterate for clarity: there is an important distinction there versus "within an app.cfc function" - you can't just create any function in app.cfc for evaluating the mapping. It's a question of being called after the point when the values have taken effect, which occurs before the first of on(Application|Session|Request)Start but after the pseudo-constructor code has been executed.

                                Hopefully that makes sense?


                              • Peter Boughton
                                Well you re right to conclude that FUSEBOX_APPLICATION_PATH doesn t apply to plugins. Plugins are expected to be within the fusebox5 directory, alongside
                                Message 15 of 16 , Nov 19, 2012
                                  Well you're right to conclude that FUSEBOX_APPLICATION_PATH doesn't apply to plugins.

                                  Plugins are expected to be within the fusebox5 directory, alongside lexicons and errotemplates (rather than as part of your app).

                                  There might be a way to change that, by overriding the this.pluginsPath variable used in fuseboxApplication.cfc - something like:

                                  application[variables.FUSEBOX_APPLICATION_KEY].pluginsPath = '../app/plugins'

                                  That's only from a brief look - not tested and possible it needs more than that.
                                • Peter Boughton
                                  Argh, looks like I was incorrect with that last message. Was getting various interruptions and mis-read the code rather than checking things properly. :( ...
                                  Message 16 of 16 , Nov 19, 2012
                                    Argh, looks like I was incorrect with that last message. Was getting
                                    various interruptions and mis-read the code rather than checking
                                    things properly. :(

                                    The skeleton app has a plugins dir inside the app directory, and states:

                                    > If you use any plugins, be sure to put them in a sub-directory off the root
                                    > of your apps called "plugins". Fusebox will look for them here. If you use
                                    > many plugins, then you can consider putting them in sub-directories below
                                    > the "plugins" dir, being careful to specify the path to them in your
                                    > application's fusebox.xml relative to the "plugins" dir.


                                    Will test the actual behaviour of that in a moment.


                                    Are you intending for the parsed directory to be in wwwroot/parsed or
                                    in app/parsed - you currently have both?
                                  Your message has been successfully submitted and would be delivered to recipients shortly.