[coldbox:4137] coldbox.system.web.context.RequestContext.init() being called twice per request

Hi I'm running ColdFusion 3 r3090 from SVN and have noticed that my
calls to event.buildLink( 'foo.bar' ) when I reinit the framework are
in the format:

http://localhost/mysite/index.cfm/foo/bar

however, when I don't call the reinit, then the link is:

/foo/bar

which doesn't work on my set up.

getSetting( 'htmlBaseURL' ) always returns http://localhost/mysite/
and getSetting('sesBaseURL') always returns http://localhost/mysite/index.cfm
(regardless of the whether the framework has been reinitialized)

My routes.cfm looks like this:

<cfscript>
  // 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");
  }

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

ColdBox.xml.cfm looks like

  <Interceptors>
    <!-- USE ENVIRONMENT CONTROL -->
    <Interceptor class="coldbox.system.interceptors.EnvironmentControl">
      <Property name='configFile'>config/environments.xml.cfm</Property>
    </Interceptor>
    <!-- USE AUTOWIRING -->
    <Interceptor class="coldbox.system.interceptors.Autowire" />
    <!-- USE SES -->
    <Interceptor class="coldbox.system.interceptors.SES">
      <Property name="configFile">config/Routes.cfm</Property>
    </Interceptor>
    <!-- @SIDEBAR@ -->
  </Interceptors>

I don't have a ColdBox config written in script. I've also gone
through my code to make sure that I'm not calling setBaseURL() or
setSESBaseURL() anywhere else in the app.

After step debugging through the app I can see that the
RequestContext.init() method is being called twice in the request
cycle. The second time the SESBaseURL property is not passed in
arguments.properties.

Is there any reason why
coldbox.system.web.context.RequestContext.init() should be called
twice?

Thanks!

Quick update, out of curiosity I switched svn to
Error 404: File Not Found | Assembla and I
didn't get the same problem.

Hope that helps.

I can confirm that experience in M5.

If...

coldbox.configAutoReload = true;

...then event.buildLink( 'foo.bar' ) returns...

/foo/bar

...else event.buildLink( 'foo.bar' ) returns...

http://localhost/mysite/index.cfm/foo/bar

Had me questioning my experience in M4.

Might be because the fw is realoding in each request. Weird
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Also, in all reality, you should NOT be developing with config auto reload = true. That is to test the first iteraction to the website.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Fair point Luis! Just thought it was worth a mention as it seems to
have been introduced in m5 and the config I was using was built by the
dashboard so I think others will have the same issue.

Yea, strange behavior, don’t know why thought, any thoughts?
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Hey Luis, I did try to find out why it did it by step-debugging. Could really do with being able to step-backwards when it happens so you could find out what called it :slight_smile:

I’ll let you know if I do find it.