fw1
  • randyjohnson

    randyjohnson

    07/27/2022, 1:32 PM
    Hello everyone, the new subsystem style looks like it would be beneficial if I wanted to start saving different modules for my websites in forgebox or github and then easily install them using commandbox. Was that the thought in mind with the new rewrite?
  • s

    Steve

    07/30/2022, 6:56 PM
    Hi all. I can't say it enough, I love FW/1. I am using version 4.3.0 and I noticed what I would call a bug, but maybe just an incorrect assumption. The application.setupResponse() is being called after the response has been output, not prior. I was hoping to add an elapsedTime field to my output within this function. It can't. I call it a bug because of the name, "setup" Response, implies just before the response is finalized, as opposed to "post" or "after" Response. Anyway, I'll figure out a way around my issue but I thought I would post my issue here.
  • Rich Symons

    Rich Symons

    08/12/2022, 5:14 PM
    Hello! Hope someone can lend a hand. I implemented security features based on https://github.com/ddspringle/framework-one-secure-auth by Denard Springle. All worked great until our CF JDK was upgraded from jdk-11.0.15 to jdk-15.0.1 Now we get an error "The BLOWFISH/CTR/PKCS5Padding algorithm is not supported by the Security Provider you have chosen." Any advice on how to fix would be greatly appreciated.
    // master
    case 'master': // using master encryption, encrypt with the master key onePass = encrypt( arguments.value, variables.masterKey, 'AES/CBC/PKCS5Padding', 'HEX' ); lastPass = encrypt( onePass, variables.masterKey, 'BLOWFISH/CTR/PKCS5Padding', 'HEX' ); break;
  • f

    Formiko

    08/21/2022, 1:59 AM
    I just got this on fw1..https://www.wcl.american.edu/sjd/spp/index.cfm It seems like index,cfm is blank and Application,cfc has all the logic. I have to change only one line in the frontfacing side, but I can't seem to find where it is? Do any of you FW/1 gurus wanna throw me a bon which section I should look in? view or model or do you want to see Appliation.cfc?
  • rodyon

    rodyon

    09/10/2022, 4:29 PM
    hello, I was thinking of good way to implement 'skins' for fw/1 application. At one point, I think - what if /views and /layouts to be stored in 'theme' folder and location of 'theme' to be controlled by settings? I know this may sound like rare use case, but as exercise may bring some fun 🙂 Changes in Framework One itself will be required but it's the best path.
  • s

    Scott Conklin

    09/16/2022, 2:46 PM
    Hi
  • s

    Scott Conklin

    09/16/2022, 2:49 PM
    Is there anyway to abort processing in a before() method and prevent it from executing item(). I am checking for an error and then I want to just want to go straight to renderdata and do nothing else: setting a return in before() does not seem to prevent it from continuing on to the item() method.
    rc["response"]["errors"] = 'Sorry, something went wrong';
    variables.fw.renderData().type( 'json' ).data( rc.response ).statusCode( 200 ).statusText( "Successful" );
    return;
  • f

    Formiko

    09/20/2022, 7:40 PM
    this is the rl how do I add stuff to thre main index.cfm page?https://www.blahbah.com/career/mentor/index.cfm/main/new/hash/6482DDCFABB7C0F1 trhe index.cfm is blank but it seems Application.cfc has stuff. I'm rtrying to add a capctchah to the form. Thnaks
  • f

    Formiko

    09/21/2022, 12:46 AM
    I'm having a lot of trouble figuring this out, so the clients recommended disabling the form. Where do I look to make a page invisible in the framework?
  • f

    Formiko

    09/21/2022, 12:47 AM
    I think the MVC concept confuses me
  • f

    Formiko

    09/21/2022, 1:10 AM
    I'll try to simplify my problem. I work for a university and each department has it's own setup. A couple of years ago a developer came in and made only one of the department's websites in framework1. Every department has a form of some sort and I put captcha on all of them because of all the spam bots, EXCEPT one department which has FW-1. So while I'm trying to figure out framwework1, how do I disable the form completely. or make that particular page invisible until I get it to work?
  • rodyon

    rodyon

    09/21/2022, 12:27 PM
    I bet Framework One does not stand in your way in this case. Search for < form > HTML tag and add captcha to it. Captcha is just another field in the form in most cases. Your form is somewhere in /views folder, probably under /main/new, I think.
  • f

    Formiko

    09/21/2022, 1:43 PM
    thank you
  • f

    Formiko

    09/21/2022, 1:51 PM
    That was it! I just needed to get out of my own way
  • g

    GVJustDOIT

    09/27/2022, 7:03 PM
    Hi, I have upgraded from FW1 3.1 to 4.3 (the latest version) and the beans are not initializing properly. Can anyone have any suggestions?
  • s

    Scott Conklin

    09/28/2022, 11:42 PM
    Is it not possible to set some application variables from a property injected dependency inside of setupApplication()? This does not throw an error, but I am experiencing strange behavior; namely the application variables are not defined.
    property config;
    
    ...
    
    	public void function setupApplication() {
    		settings = config.getSettings();
    	    	
    		application.AESKey = settings.keys.AES ;
    		application.captchaKey = settings.keys.captcha;
    		application.VTID = settings.application.vtid;
    		application.COTID = settings.application.cotid;
    		application.securelist = settings.securelist;
    		application.env = getEnvironment();
    		
    	 }
  • c

    Charles Robertson

    11/02/2022, 9:17 AM
    Hi everyone Isn’t it dangerous to use the variables scope in components that have been cached in the Application scope? It seems that by default, all FW1 services are singletons? Here is a bit more detail about what I mean. I am using FW1 and I have just found out that controllers and services are singletons [application scope]: https://framework-one.github.io/documentation/4.3/developing-applications/#services-domain-objects-and-persistence Inside one of my controllers, I have made two method calls: blogController
    function list(rc){
        rc.page = 1;
        variables.blogService.page(rc.page);
        rc.data = variables.blogService.list();
    }
    blogService
    component accessors = true{
        variables.blogs = {};
    
        // constructor etc…
     
        function page(page){
            // build variables.blogs struct from DB query
        }
     
        function list(){
            return variables.blogs;
        }
    }
    So, essentially, the
    blogService
    page method uses a DB query to populate:
    variables.blogs
    And then I immediately return this variable, in the
    list()
    method. What worries me, is that if there are two different requests like: REQUEST 1:
    rc.page = 1;
    variables.blogService.page(rc.page);
    rc.data = variables.blogService.list();
    REQUEST 2:
    rc.page = 2;
    variables.blogService.page(rc.page);
    rc.data = variables.blogService.list();
    The list data might get mixed up? My question: Are the two method calls, atomic, in the
    blogController
    , per request? I know that Coldfusion is multi-threaded, so requests are dealth with, in parallel. I am worried that the following might happen:
    REQUEST 1 rc.page = 1;
    REQUEST 1 variables.blogService.page(rc.page);
    REQUEST 2 rc.page = 2;
    REQUEST 2 variables.blogService.page(rc.page);
    REQUEST 1 rc.data = variables.blogService.list();
    REQUEST 2 rc.data = variables.blogService.list();
    Essentially, the user responsible for REQUEST 1 will receive the REQUEST 2 data. I feel that data is safe, within a singleton, as long as methods are UDFs [functional/stateless methods], but when there is stateful data, in a singleton, then the alarm bells start ringing. I am not sure why I decided to create a component variables variable, but I think I found it in an FW1 example. The three potential solutions I have, are: 1) Make services instances, not singletons [remove from the application scope] CANNOT DO THIS AS FW1 THROWS AN ERROR 2) Lock the two method calls, like:
    cflock (name="listBlogService", type="exclusive", timeout="30") {
        variables.blogService.page(rc.page);
        rc.data = variables.blogService.list();
    }
    3) Remove the
    blogService
    list()
    method and return the list from the
    page()
    method. This would turn the
    page()
    method into a UDF, removing references to state. I am veering towards option 3?
  • rodyon

    rodyon

    11/02/2022, 10:32 AM
    REQUEST 1 rc.data = variables.blogService.list();
    REQUEST 2 rc.data = variables.blogService.list();
    I think if something like this happen in Lucee/Coldfusion, it would be abandoned somewhere around year 2000 as unusable platform. I'm not big on multithreading, but never got an issue you mentioned with cfml or fw/1 in years.
  • c

    Charles Robertson

    11/02/2022, 11:30 AM
    Well. Normally I would agree with you, but because the entire application is sharing what is read/written to
    <http://variables.blog|variables.blog>
    , I am not so sure. I mean, we are sometimes meant to lock down application variables and other bits of code that might spawn a race condition. I just wondered whether this is one such example?
  • rodyon

    rodyon

    11/02/2022, 1:11 PM
    I don't thing it's possible to have race condition in REQUEST scope. Setting APPLICATION or SESSION vars should be Exclusively-locked I think.
  • websolete

    websolete

    11/02/2022, 1:18 PM
    no race conditions BETWEEN requests. application and session writes are thread safe but only within their respective application.cfc methods (onApplicationStart() and onSessionStart()). you'd most likely need to lock writes elsewhere if there's the possibility of race conditions
  • websolete

    websolete

    11/02/2022, 1:19 PM
    at least that's my understanding
  • j

    Jim Priest

    11/02/2022, 1:22 PM
    It's early so maybe I'm misunderstanding this - but why not use the 'local' scope (or var)? "Variables that you declare with the Var keyword inside a cffunction tag or CFScript function definition are available only in the method in which they are defined, and only last from the time the method is invoked until it returns the result. The Variables scope is not the same as the function local scope, which makes variables private within a function. Always define function-local variables using the var keyword of the Local scope name."
  • rodyon

    rodyon

    11/02/2022, 1:36 PM
    FW/1 injects Service into Controller's variable scope
  • c

    Charles Robertson

    11/02/2022, 1:57 PM
    Yes. But all controllers/services are placed in the application scope, by default. When we inject into a controller like:
    property fooService;
    My understanding is that because the actual controller component is in the application scope, everything inside the component, including properties, which are in the
    variables
    scope, also persist. You can see this when you dump out the application scope. The point I am trying to make, is that any variable inside a service, in the
    variables
    scope, is a singleton, as well. This makes it vulnerable to being changed by more than one request. If services were transients, each request would get given a new instance. In this case, there would be no problem, because each request would be given its own copy of all the variables inside each service.
  • c

    Charles Robertson

    11/02/2022, 2:03 PM
    If you dump out the application scope, you will see the controllers/services. The beans are transients [instances]
  • websolete

    websolete

    11/02/2022, 2:30 PM
    i still think the flaw is mutating variables-scoped variables in singletons. it just feels you're trying to plug a hole created by not having any DAOs (which would be injected into the services as required)
  • c

    Charles Robertson

    11/02/2022, 3:17 PM
    I should be using DAOs, but to be honest that would only provide an extra level of organisation. However, I absolutely agree with your opinion about
    variables
    scope mutation inside a singleton. I only used this approach, because I found it in an FW1 example application. And to be fair, the objective, within the example app, was very possibly correct and I corrupted it. So, I’m going to remove the
    variables
    scope variable and just return the list data from the
    page()
    method. Before:
    function page(page){
        // build variables.blogs struct from DB querycfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
            // add blog bean to variables.blogs
            …
            variables.blogs[local.qGetFile.File_ID] = blog;
        }
    }
    After:
    function page(page){
        // build variables.blogs struct from DB querylocal.pagedata = {
            recordcount: local.recordcount,
            list: {}
        };
       cfloop(query=local.qGetFile, startrow=local.startrow, endrow=local.endrow){
            // add blog bean to variables.blogslocal.pagedata.list[local.qGetFile.File_ID] = blog;
        }
        return local.pagedata;
    }
  • s

    seancorfield

    11/02/2022, 5:35 PM
    To answer the question: do not use variables scope in controllers for request-specific data ever. Use
    rc
    or local/var scope variables only. The
    variables
    scope of a controller should only be used to cache global state (like an in-memory copy of a fixed lookup table or some such) and should either be initialized in the constructor method
    init()
    via dependency injection, or with careful locking as if dealing with
    application
    scope.