1. #21
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,365
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Glad to hear that people are up and running with this!

    Cutter, I'll fix the bug you reported within Api.cfc. Is anyone interested in contributing to DirectCFM? I could put it up on RIAForge.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  2. #22
    Ext JS Premium Member CutterBl's Avatar
    Join Date
    Aug 2007
    Location
    Nashville, TN
    Posts
    236
    Vote Rating
    0
    CutterBl is on a distinguished road

      0  

    Cool RIAForge DirectCFM

    RIAForge DirectCFM


    @aconran

    Yeah, I'm updating my CFQueryReader examples using Direct. Want to put together a quick paging grid example for people. I think putting DirectCFM up on RIAForge is a great idea, though I think you might add your Echo.cfc and example code first, to give some direction.
    --
    Steve "Cutter" Blades
    Adobe Community Professional - ColdFusion
    Adobe Certified Professional - Advanced Macromedia ColdFusion MX 7 Developer

    _____________________________
    Blog: Cutter's Crossing

    Co-Author "Learning Ext JS 3.2"

  3. #23
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Boca Raton, FL
    Posts
    94
    Vote Rating
    1
    jimmifett is on a distinguished road

      0  

    Default


    I've heavily modified your very useful and educational stack.

    The version I have acts as a stateful bean, holding a list of registered components and their exposed methods. It gets loaded into application scope. This allows the api script generation to not have to do as much work since all the component reflection is done once, yet additional components can be registered with the bean (think management console for ExtDirect cfcs).

    I added an attribute to the cfcomponent tag, AllowExtDirectReflection (boolean) that is required for any component to be registered with the bean. This is to give the ability to scan directories (still under construction) and only pick up cfcs specifically designed to implement ExtDirect.

    Each cffunction in a cfc will also require an ExtDirect attribute (boolean) in order for the method within the cfc to be register with the bean, as you already have. The method to register components also has 4 optional flags, allowExtDirectRemote, allowExtDirectPublic, allowExtDirectPackage, allowExtDirectPrivate. These allow the registration method to register only specific access levels and ignore methods even if they have the ExtDirect attribute. In case you want to prevent private methods and such from ppl copy pasting code around willy nilly being exposed that you didn't know about, or want to keep remote level as some sort of wrapper for a public level function. Even more useful for registering whole directories. Of course, I don't know why any sane person that would want to expose their non public or remote methods, but the option is there.

    Also added was the restriction of invoking methods if that function has a Role attribute and the user does not have a valid role in that list, thus preserving application security even when exposed via Ext.Direct.

    My version also checks to make sure there are sufficient arguments to atleast match if not exceed any cfargument tags with the Required attribute set. Also makes sure the are not more params than arguments.

    Finally, it introduces an error handling system that i use for just about everything else. If properly implemented in cfc design, it allows very useful debug info similar along the lines of a java Exception.

    Almost forgot, I also rewrote as much as inhumanly possible in cfscript and fully scoped out loose variables, type checking, and added access levels to all the code.

    I have no idea where to put these up for ppl to use, any suggestions?

    Application.cfc //example simple framework (a lite version of a more robust framework I use) created showing how to instantiate the bean and register cfcs

    ExtDirect.cfc //replaces Direct.cfc. Still needs work for the mass recursive directory registration.

    API.cfm //slight tweaks to api.cfm

    Router.cfm //medium rework of Router.cfm

    Example.cfc //a sample cfc showing off features

    Example.cfm //test page using the above

    -Jim
    Last edited by jimmifett; 3 Jun 2009 at 12:26 PM. Reason: typos

  4. #24
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,365
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Jim -

    Sounds great, I'd love to see it; You should be able to attach it here on the forums for people to download or create your own thread and name it something different since it has been changed so much.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #25
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Boca Raton, FL
    Posts
    94
    Vote Rating
    1
    jimmifett is on a distinguished road

      0  

    Default


    I went ahead and forked it since there is considerable difference code and feature wise. It'd be confusing to others trying to follow both pieces of code.

    http://extjs.com/forum/showthread.php?t=70264

    Thanks again. This was a great introduction to the underpinnings of Ext.Direct.

  6. #26
    Ext User
    Join Date
    Jul 2009
    Posts
    1
    Vote Rating
    0
    srconklin is on a distinguished road

      0  

    Default directCFM and ColdBox

    directCFM and ColdBox


    Do you have any samples of this working in conjuction with a ColdBox Application?
    thanks

  7. #27
    Ext User
    Join Date
    Mar 2009
    Posts
    27
    Vote Rating
    0
    TomChiverton is on a distinguished road

      0  

    Default Railo support

    Railo support


    I had to make a few minor mods to get this to run under the Railo CFML engine.
    Router.cfm needs to check for the absence of the form variables in it's first CFIF, and Direct.cfc's invokeCall() needs to scope all references to the 'request' argument.

    Patch attached.
    Attached Files

  8. #28
    Ext JS Premium Member Gjslick's Avatar
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    129
    Vote Rating
    6
    Gjslick will become famous soon enough

      0  

    Default


    Hey Aaron, first off, thanks for your example CF stack code. I'm currently putting together a simple application instantiated rendition of it, to save on the introspection step, and to cover CFC's in sub directories. Didn't want to go quite as far as jimmifett's version (although nice job Jim), but still wanted good performance on the requests for the API, and the ability to keep my components in the packages that they're currently in.

    Was wondering about something though. What made you decide to get the request's post body the way you did?
    Code:
    <cffunction name="getPostBody" returnType="string" output="false">
        <cfscript>
            var size=GetPageContext().getRequest().getContentLength();
            var emptyByteArray = createObject("java", "java.io.ByteArrayOutputStream").init().toByteArray();
            var byteClass = createObject("java", "java.lang.Byte").TYPE;          
            var byteArray = createObject("java","java.lang.reflect.Array").newInstance(byteClass, size);
            GetPageContext().getRequest().getInputStream().readLine(byteArray, 0, size);
            createObject('java', 'java.lang.System').out.println("{GetJSONRequest} ByteArray.ToString=" &ToString( byteArray ) );
            return ToString( byteArray );
        </cfscript>
    </cffunction>
    Instead of doing something simple like this:
    Code:
    <cfset postBody = toString( getHttpRequestData().content )>
    Any reason? Performance? Yours works in more situations? (Possibly didn't know about getHttpRequestData?) Was basically wondering if I needed to include that code in my final version or not.

    Thanks man, and appreciate it.

    -Greg

  9. #29
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,365
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    That looks much simpler! That bit of code to pull the body of a post was written several years ago.

    I used it on a CFMX 6.1 project and I knew that it worked

    Looking forward to seeing your implementation!
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  10. #30
    Ext JS Premium Member Gjslick's Avatar
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    129
    Vote Rating
    6
    Gjslick will become famous soon enough

      0  

    Default


    Well that answers that question! lol

    Alritey, I'll post my code when I'm done. I'm actually almost finished, just gotta work around an issue with ColdSpring's AOP templates not parsing correctly (for all you ColdSpring users, myself included ), and then test it out a bit. I'll try to put it up in the next day or so.

    Thanks again,

    -Greg