[ Tip Of the Week ] Introducing ColdBox MVC to a legacy app

174 views
Skip to first unread message

br...@bradwood.com

unread,
Jan 19, 2016, 1:31:43 PM1/19/16
to ColdBox List
Since I get a lot of questions about how to introduce ColdBox MVC into an existing legacy app, I have created a sample app on GitHub that you can install and run in a matter of seconds with CommandBox that shows how to set it up.  Read more here on the blog post:
 
 
Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 

Pritesh

unread,
Jun 13, 2018, 11:17:20 AM6/13/18
to ColdBox Platform
Hi Brad

I have knowledge of coldfusion but this is first time i am working with coldbox.

We  wanted to convert our existing application to coldbox platform one by one.


I have created a project from your link.


mkdir coldbox-legacy-app-demo --cd
install bdw429s/coldbox-legacy-app-demo
server start

As on production server we have Coldfusion 10 so the latest coldbxo version is not supporting in coldfusion 10. So i have download and used a coldbox 4.3 version.

This is working fine in Local throught commandbox.

When i upload the same code to a test directory called "coldboxdemo" in our webroot. But it  is not working.

But when i Run the demo it is not working. (domain.com/coldboxdemo/index.cfm).

Can you please help me with this. I am stuck in the middle.

Below is my code in application.cfc

/**
********************************************************************************
Copyright from 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
********************************************************************************
*/
component extends='coldbox.system.Bootstrap'{
this.mappings["/coldbox"] = 'C:\inetpub\wwwroot\coldboxbackup\coldbox';

public boolean function onRequestStart(String targetPage){
// Map physical files to events
// This will allow the old URL for the about page to remain unchanged from the URL.
// This is just an example to show how to do this in case you CAN'T break book marks.
// Of course, URL rewriting wold also be a valid way to solve this too.



fileEventMap=StructNew();

fileEventMap = {
'/coldboxbackup/about.cfm':'main.about',
'/coldboxbackup/products/coldbox.cfm':'products.coldbox'

};

if(StructKeyExists(fileEventMap,arguments.targetPage ) || ( arguments.targetPage == '/coldboxbackup/index.cfm'))
{

if( StructKeyExists(fileEventMap,arguments.targetPage ) ) {
url.event= fileEventMap[arguments.targetPage];
}

// Verify ColdBox is loaded
reloadChecks();

processColdBoxRequest();
// Returning false prevents the legacy code from also kicking in
return false;
}

// Else proceed to legacy code
return true;
}

}

I am getting below error.

Oopsy! Something went wrong!

Type: Expression 
* The full robust errors can be seen by switching the coldbox.customErrorTemplate in your configuration file (/config/ColdBox.cfc) to "/coldbox/system/includes/BugReport.cfm" and reloading the application.



Even i changed coldbox.customErrorTemplate path  i am not getting proper error.

I was just trying to check which line is giving error by putting abort.

On Bootstrap.cfc it is giving from below lines.

if( NOT event.isNoExecution() )
{
refResults.results = cbController.runEvent( defaultEvent=true );
}


Can you tell me do i need to make any other change ?

Thanks in Advance.

Brad Wood

unread,
Jun 15, 2018, 8:06:25 PM6/15/18
to col...@googlegroups.com
You will need to reinit the framework after you change the default error template for the change to take effect. 

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/ed517ee8-70ad-4f8b-99e7-30cd34c409c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pritesh

unread,
Jun 19, 2018, 9:47:05 AM6/19/18
to ColdBox Platform
Hi Brad

Thanks for your reply.

This is now working but i am facing some issue in this.

I have applied rule which takes tellafried page processed as coldbox.

I want the url to be same but it should process through coldbox.

This is working some times but it suddenly stops working after some time.

It keeps switing on and off multiple times in a day.

I am getting below error when it is not working.

Oopsy! Something went wrong!

Type: HandlerService.EventHandlerNotRegisteredException 
* The full robust errors can be seen by switching the coldbox.customErrorTemplate in your configuration file (/config/ColdBox.cfc) to "/coldbox/system/includes/BugReport.cfm" and reloading the application.


I am not sure why this is working sometimes and sometime it stops.

Can you please help me.
Reply all
Reply to author
Forward
0 new messages