I'm wondering if anyone can shed some light on thi...
# fw1
a
I'm wondering if anyone can shed some light on this. In the /framework/one.cfc onSessionStart() method, the setupRequestDefaults() is called first. This has the repercussion of not being able to use an added route (via addRoute()) that's been added during the onRequestStart() for the initial request of the session. (because routes are only processed once in the request). In review of setupRequestDefaults(), I don't see anything that's required for the session - but I could be missing something. I guess I just want to see if there's a reason it's being called on the session start.
Copy code
public any function onSessionStart() {
        setupRequestDefaults();
        setupSessionWrapper();
    }
m
i think it's necessary for the framework trace.
a
The trace is stored in the request scope - having it initiate in the session scope shouldn't impact it's use. In the small amount of testing I've been able to get to this morning, it doesn't look like removing the setupRequestDefaults() from the onSessionStart actually changes any of the functionality. It actually just reduces the number of calls to the same function.
s
Did you test across multiple engines and multiple versions? I have some vague recollection that session start and request start were called in a different order on Railo/ACF back in the day...
a
I have not yet. Currently, I'm extending one.cfc and am just overwriting the onSessionStart method with one sans-setupRequestDefaults(). If I pursue this further, I will run it through the different engines before making the recommendation.
👍🏻 1
m
setupSession() happens first, at least in lucee, before setupApplication(), setupSubsystem() or setupRequest()
my 'necessary for the framework trace' was more about allowing the trace that is called to know if trace was set on or off based off the framework config. which comes from the setupFrameworkDefaults() which is called from setupRequestDefaults()
I haven't used addRoute(), but my interpretation is you could add them anytime, but the newly added would likely not work against the current request, it should against subsequent requests, at least until config is reloaded. I personally override getRoutes() in my Application.cfc