[coldbox 4.1] Hybrid Fusebox App

19 views
Skip to first unread message

brett

unread,
Jul 21, 2016, 8:45:57 AM7/21/16
to ColdBox Platform
Hello,

I'm looking into moving our legacy application written in FB5 into the Coldbox framework a section at a time and am having a problem with not being able to see output from a coldbox request.  The general setup I went with is to put our coldbox code in a subfolder underneath the existing app like so:

-FB5App
--_coldbox
----handlers
----layouts
----model
----view
--controller
--model
--view
--Application.cfc
--index.cfm


We have set up a very basic hello world page in the coldbox app.  We are also bootstrapping the CB framework in the application.cfc.  Our 'onRequestStart()' method looks like this:

<cffunction name="onRequestStart" returnType="boolean" output="No">
<cfargument type="String" name="targetPage" required=true/>
 
<!---
 Provide us a way to do some manual initialization
 --->

 
<cfif IsDefined("url.refreshApp")>
 
<cfset onApplicationStart()/>
 
</cfif>
 
 
<!---
 Relocate user to index.cfm if they aren't already going there
 --->

 
<cfsilent>
 
<cfif right(cgi.script_name, Len("index.cfm")) NEQ "index.cfm" AND right(cgi.script_name, 3) NEQ "cfc">
 
<cflocation url="index.cfm" addtoken="no">
 
</cfif>
 
</cfsilent>
 
 
<cfset request.bypass_fusebox = false/> <!--- variable used to bypass fusebox processing in index file --->
 
<cfif StructKeyExists(url,'cbevent') or StructKeyExists(form,'cbevent')>
 
<!---// Process ColdBox Request--->
 
<cfset application.cbBootstrap.onRequestStart( arguments.targetPage )/>
 
<!--- set variable that will bypass fusebox code in the index file --->
 
<cfset request.bypass_fusebox = true/>
 
</cfif>
 
 
<cfreturn true>
</cffunction>


In our index.cfm I have this:

<cfsetting enablecfoutputonly="no">

<cfif not request.bypass_fusebox>
 
<cfinclude template="fusebox5.cfm">
</cfif>

Basically what I'm doing is checking to see if I have a URL/Form variable called 'cbevent' (the eventName setting has been configured in coldbox.config) and if I do  i process the the request using Coldbox and if not I process using Fusebox.  However when I call my main.home event I get no output from the request.  I know CB is processing the event because if I put a 'cfabort' in the Main.cfm layout file I can see the output from my view.  I have to be missing something simple?

Thanks.
Brett

brett

unread,
Aug 16, 2016, 2:30:19 PM8/16/16
to ColdBox Platform
Turns out I was missing something simple.  To anybody trying to do this or anyone using a tag based application.cfc,, the 'output' attribute of the 'onRequestStart' method should be set to Yes/True.
Reply all
Reply to author
Forward
0 new messages