application.cfc / cfm not working – Linux Only

Recently, I have moved one of my ColdFusion website from windows server to Linux hosting server. And I got the error that variable ‘Application’ is undefined. I have checked whole my application.cfc and can’t got the issue first but after sometime I remember that the issue with linux server and my application.cfc file name.

If you are using ColdFusion on Linux based servers and have an application.cfm/cfc that is not defining the variables and settings with your ColdFusion code then just you need a capital ‘A’ on the file name shown below:

CORRECT:
  • Application.cfm
  • Application.cfc

INCORRECT
  • application.cfm
  • application.cfc
If this still does not work make sure to check your permissions on the file are set to be readable. You can always contact the support team if you require any assistance.
Advertisements

REST services in ColdFusion 10

RESTful Web Services are becoming increasingly popular mostly because of their simplicity and ease of use. You can access RESTful Web Services easily over HTTP/HTTPS. ColdFusion 10 provides support REST services. You can easily expose your ColdFusion Component (CFC) as a RESTful Web Service through a few attributes you specify within your CFC.

Some new attributes are added in ColdFusion10 to help you create a REST service to the following ColdFusion tags: cfcomponent , cffunction , and cfargument . Once you create a component and register it with the Administrator, you can access it via a HTTP request.

First, specify the rest attribute as true within the CFC, along with the restpath attribute, which specifies the path of the service accessed over HTTP. On every function in the CFC it is possible to associate the HTTP method that should invoke the corresponding function.

For more information: click here – There is such a nice article by Sagar Ganatra regarding how to getting started with REST services in ColdFusion 10.

Form Fields with the same name – ColdFusion 10

In ColdFusion when you submit form, and the form contains multiple form fields with the same name (a list of checkboxes, for example) that these values will be available to us as a comma-delimited list in the FORM scope.

ColdFusion 10 gives us the ability to transform these lists into arrays automatically. It is as easy as adding the following to Application.cfc


this.sameformfieldsasarray = true;

Now, anytime you submit a form where more than 1 form field share a name, the value of FORM.{fieldName} will be an array instead of a list.