M6 Beginner Problems

I'm brand new to ColdFusion and to ColdBox, so please forgive me if I
have missed anything terribly obvious. Please feel free to say RTFM...
just point me to a URL :slight_smile:

Short version of the problem: With default everything, I'm having
problems where the routes that are being generated for my event
handlers are incorrect.

I have ColdFusion Developer edition installed locally as a standalone
server w/ JRun.
I have FlashBuilder on which I've installed CF Builder and have set up
my local server.
I downloaded the M6 release of ColdBox and installed it as 'coldbox'
in my wwwroot.
I installed the Platform Utilities CFBuilder extensions.
I created a new CF Project called "VTMO" with the application
directory as wwwroot/VTMO.
I used the ColdBox extension to initialize a new ColdBox Advanced app.
I fired up http://localhost:8500/VTMO/index.cfm on my server...

So, everything appears to load correctly. When I look at the paths for
the event handlers they are (correct?) as follows:
http://localhost:8500/VTMO/index.cfm/General (etc.)

However, when I click on the General link, the contents of the page
appear to reload and the event handler links now look like this:
http://localhost:8500/General

Obviously they don't work.

If, instead of clicking on "General" initially (when the link urls
were correct), I clicked on "Main" there is a redirect to:
http://localhost:8500/General/index which is not found.

I assumed this was because my appMapping configuration was wrong/
missing, so I added/updated the value in my ColdBox.cfc to reflect
"VTMO". The result was the same even after reloading the framework. I
also tried renaming the coldbox.xml.cfm.bak and changing the setting
there as well with the same result. Do I need to use the xml file if
I'm changing the cfc?

So, I'm not sure where to start at this point. Any help would be
GREATLY appreciated.

Ben,

What does your routes.cfm file look like in the config folder?

Curt Gratz
Computer Know How

Not at a machine w ColdBox right now, but look for a setting called
something like URL Rewrite Rule. It's intended to support url munging
by the web server, including adding the 'index.cfm' portion for
certain urls. I think the default works with that configuration; take
a look at the other choices. I think it was there in the app generator
too, so i think you'll see the choices there if you pretend to start
another site. Check the docs about that too.

Dave

The documentation wiki is here: http://wiki.coldbox.org/

But, if you really want to get your hands on CB quickly and easily,
purchase Luis' book here:

It is a great resource, and will get you up to speed much faster than
reading dry documentation (although Luis' documentation by far better
than most)

What’s odd is that the Event Handlers have the correct URL the FIRST time the page loads #event.buildLink(handler)#.

After that they change URLs. I looked through the config and could only find a couple of settings related to URL – BaseURL and htmlBaseURL which should reflect whatever I change in routes. I haven’t made any changes in routes. The difference between the the working URLs is more than just the index.cfm being dropped, it also drops the base path of the app.

e.g., http://localhost:8500/VTMO/index.cfm/General becomes http://localhost:8500/General

I guess my questions are: a) Why would these urls only behave correctly the first time the page loads and b) shouldn’t this work out of the box given that it’s a default app?

I did buy the book and have been reading through it on my iPad for about a week. It’s pretty helpful.

Ben

Thanks for looking into this!

I was able to make the entire app behave as it should by disabling the routes interceptor through ‘setEnabled(false)’. Though I don’t think I should have to disable it.

This is what it looked like out of the box though. It looks like it would work if I had AppMapping set correctly. Maybe I need to couple it with setBaseURL and htmlBaseURL settings?

// General Properties setEnabled(true); setUniqueURLS(false); //setAutoReload(false);

// Base URL
if( len(getSetting(‘AppMapping’) ) lte 1){
setBaseURL(“http://#cgi.HTTP_HOST#/index.cfm”);
}
else{
setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/index.cfm”);
}

// Module Routing Added
addModuleRoutes(pattern="/forgebox",module=“forgebox”);

// Your Application Routes
addRoute(pattern=":handler/:action?");

Correct, If your application isn’t off of webroot, you would need to use it.

Curt

Ben,

Welcome to the ColdBox community!

I am actually going to take stab at this, as it sounds like you have rewrite
rule engine installed but you're not using the SES in the code.

Or it could be the other way around, they you are trying to use SES without
a rewrite engine attached to IIS / Apache.

Regards,
Andrew Scott
http://www.andyscott.id.au/