From 0450e0f55a225f016a03e9791aa924fed71975ef Mon Sep 17 00:00:00 2001 From: Giancarlo Gomez Date: Thu, 16 May 2024 16:07:58 -0400 Subject: [PATCH] Added isBoxLang to BaseProxy variables Added check for boxlang server key and required shortcut updates to loadContext and unLoadContext BOX-142 --- models/BaseProxy.cfc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/models/BaseProxy.cfc b/models/BaseProxy.cfc index b7b4a33..a975932 100644 --- a/models/BaseProxy.cfc +++ b/models/BaseProxy.cfc @@ -48,11 +48,12 @@ component accessors="true" { variables.loadAppContext = arguments.loadAppContext; variables.threadHashCode = getCurrentThread().hashCode(); - variables.isLucee = server.keyExists( "lucee" ); - variables.isAdobe = server.keyExists( "coldfusion" ) && server.coldfusion.productName.findNocase( "ColdFusion" ) > 0; + variables.isAdobe = server.keyExists( "coldfusion" ) && server.coldfusion.productName.findNocase( "ColdFusion" ) > 0; + variables.isBoxLang = server.keyExists( "boxlang" ); + variables.isLucee = server.keyExists( "lucee" ); // If loading App context or not - if ( arguments.loadAppContext ) { + if ( arguments.loadAppContext && !variables.isBoxLang ) { if ( variables.isLucee ) { variables.cfContext = getCFMLContext().getApplicationContext(); variables.pageContext = getCFMLContext(); @@ -97,8 +98,11 @@ component accessors="true" { * Ability to load the context into the running thread */ function loadContext(){ - // Are we loading the context or not? Or we are in the same running main thread - if ( !variables.loadAppContext || variables.threadHashCode == getCurrentThread().hashCode() ) { + // If we are in BoxLang, exit out as context is handled differently. + // Or Are we loading the context or not? Or we are in the same running main thread + if ( + variables.isBoxLang || !variables.loadAppContext || variables.threadHashCode == getCurrentThread().hashCode() + ) { return; } @@ -158,8 +162,11 @@ component accessors="true" { * Ability to unload the context out of the running thread */ function unLoadContext(){ + // If we are in BoxLang, exit out as context is handled differently. // Are we loading the context or not? Or we are in the same running main thread - if ( !variables.loadAppContext || variables.threadHashCode == getCurrentThread().hashCode() ) { + if ( + variables.isBoxLang || !variables.loadAppContext || variables.threadHashCode == getCurrentThread().hashCode() + ) { return; }