Highlighted

Scope variables in application in Application.cfc

New Here ,
Oct 17, 2019

Copy link to clipboard

Copied

Good morning everyone.

I have a question regarding the lifetime of application-scoped variables.

I am migrating to Application.cfc and in my application global variables have been set (in old application.cfm)

The global variables I set in the onApplicationStart method

Example:
<cfset application.ds = 'myDatabase'>
<cfset application.table1 = 'table.table1>

That is, database table name and database name.

But I found problems with these variables
 <cfset application.URL_ARQCLI = "http: //" & # Server_Name # & ":" & # server_port # & "/ aseng / attachment / counterclient /">
Our system has the local network access url and the remote access url.
When we enter the remote access url the images are not found.

Because the variable was set in onApplicationStart, why didn't you save the reference server_name: server_port?

In my .cfm file I look for the image with the tag <image src='# application.application.URL_ARQCLI ## myImage #>

To work around the problem I set the application.URL_ARQCLI variable in the onRequestStart method and it worked.

I would like to ask a question, Application.cfm was loaded on all requests so had no problem with the variables. As server_name is set right on onApplicationStart, because images do not appear when Remote url access.

1 - local path = system.local.aseng

2 - remote path
remote.aseng: 80

Thanks.




Views

42

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Scope variables in application in Application.cfc

New Here ,
Oct 17, 2019

Copy link to clipboard

Copied

Good morning everyone.

I have a question regarding the lifetime of application-scoped variables.

I am migrating to Application.cfc and in my application global variables have been set (in old application.cfm)

The global variables I set in the onApplicationStart method

Example:
<cfset application.ds = 'myDatabase'>
<cfset application.table1 = 'table.table1>

That is, database table name and database name.

But I found problems with these variables
 <cfset application.URL_ARQCLI = "http: //" & # Server_Name # & ":" & # server_port # & "/ aseng / attachment / counterclient /">
Our system has the local network access url and the remote access url.
When we enter the remote access url the images are not found.

Because the variable was set in onApplicationStart, why didn't you save the reference server_name: server_port?

In my .cfm file I look for the image with the tag <image src='# application.application.URL_ARQCLI ## myImage #>

To work around the problem I set the application.URL_ARQCLI variable in the onRequestStart method and it worked.

I would like to ask a question, Application.cfm was loaded on all requests so had no problem with the variables. As server_name is set right on onApplicationStart, because images do not appear when Remote url access.

1 - local path = system.local.aseng

2 - remote path
remote.aseng: 80

Thanks.




Views

43

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 17, 2019 0
LEGEND ,
Oct 17, 2019

Copy link to clipboard

Copied

Hello, Carmem,

If you are setting application variables in the onApplicationStart but not restarting the application, those variables will not set.

 

One thing you can do is put the following in your onRequestStart():

 

 

 

 

<cfif StructKeyExists(url,'reinit') and url.reinit eq "true">
    <cfset applicationStop() />
</cfif>

 

 

 

 

This way, if you make changes to application scope variables in your onApplicationStart(), you can append the following to your URL to reinitialize the application:  https://www.yourdomain.com/index.cfm?reinit=true

 

This will stop the application, then the next page refresh will load the new application variables.

 

If this is not what is happening, and I misunderstood your question, please elaborate.

 

V/r,

 

^ _ ^

 

UPDATE:  I HATE THIS EDITOR.  I CANNOT REMOVE THE ANCHOR TAG!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 17, 2019 0
Adobe Community Professional ,
Oct 17, 2019

Copy link to clipboard

Copied

Did you really mean you use application.application.URL_ARQCLI? See the extra application?

 

Even if that's not it, if you view the generated html source, what does the img src value become? Does it work if you browse it? Or do you get an error that the var does not exist? 

/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 17, 2019 0