Information AboutColdfusion |
|
ColdFusion is the original and most common implementation of a tag and ECMAScript -based Programming Language -- ColdFusion Markup Language (CFML) and CFSCRIPT, respectively -- which is typically used in web application development for the generation of dynamic web pages. Originally a product of Allaire, in 2001 the company was purchased by Macromedia , who subsequently merged with Adobe Systems in 2005. ColdFusion resembles a scripting language best suited for data-driven web sites. More advanced users can use ColdFusion as a productivity layer above a J2EE platform or use ColdFusion as Middleware in a Service Oriented Architecture , such as generating Web Service s or Flash remoting. Recently, ColdFusion has also become a layer to handle asynchronous events such as SMS and Instant Messaging via its gateway interface. ColdFusion is more than a scripting language, it also provides a number of value-added services out of the box:
Other implementations of CFML offer similar or enhanced functionality, such as running in a .NET environment or image manipulation. COLDFUSION EARLY DAYS The language and its application server were originally created by brothers J. J. Allaire and Jeremy Allaire . The original server was a database to web application engine with access to all CGI information passed along with a page request. This basic beginning was expanded upon many times until the server and language was a solid enterprise level product. The engine was originally written with a C++ base that compiled the templates down to P-code . COLDFUSION MX Somewhere before 2000, Allaire began work on rewriting the basis of ColdFusion using Java (codenamed "Neo"), which would allow for greater portability among different platforms. On January 16 , 2001 , Allaire announced that it would be merging with Macromedia. Shortly after the merger, Macromedia continued with the incremental release of ColdFusion 5.00 and in June 2002 , Macromedia released Macromedia ColdFusion MX (6.0), extending the naming convention of Macromedia's line of products. ColdFusion MX was completely rebuilt from the ground up and was based on the Java 2 Platform, Enterprise Edition ( J2EE ) platform. ColdFusion MX was also designed to integrate well with Macromedia Flash using Macromedia Flash Remoting MX . Starting from the MX (6.0) release, ColdFusion is Compiled to Bytecode , like JSP and ASP.NET . The compiled .class files are readily accessible, and are cached until their source changes, like JSPs. With the release of ColdFusion MX, the CFML language was also extended to support basic OOP . Apart from the tag-based CFML syntax, ColdFusion supports embedded scripts that can be written in a JavaScript -like language. COLDFUSION MX 7 With the release of ColdFusion 7.0, the naming convention was amended, rendering the product name "Macromedia ColdFusion MX 7". CFMX 7 added Flash-based web forms and a report builder that output in Adobe PDF as well as Flash Paper , RTF and Excel . The Adobe PDF output is also available as a wrapper to any HTML page, converting that page to a quality printable document. The enterprise edition also added Gateways . (These provide interaction with such things as IM Services, SMS, Directory Watchers, and an asynchronous execution... or add your own gateways.) XML support was boosted in this version to include native schema checking. RICH FORMS With its newest release, Macromedia included a subset of its Macromedia Flex 1.5 technology. Its stated purpose is to allow for rich forms in HTML pages using CFML to generate Flash movies. These Flash forms can actually be used to implement rich internet applications, but with limited efficacy due to the Actionscript restrictions in place on Flash forms by Macromedia. Flash forms also provide additional widgets for data input, such as data pickers and data grids. In previous versions of ColdFusion, some form validation and additional widgets were available using a combination of Java applets and Javascript. This option persists for those who do not wish to use Flash, however not all features are supported. An example: PDF AND FLASHPAPER GENERATION ColdFusion can generate PDF or FlashPaper documents using standard HTML (i.e. no additional coding is needed to generate documents for print). CFML authors simply place HTML and CSS within a pair of cfdocument tags and specify the desired format (flashpaper or pdf). The generated document can then either be saved to disk or sent to the client's browser. OBJECT ORIENTED CODING IN COLDFUSION ColdFusion was originally not an Objected-oriented Programming Language , and even today lacks some OO features. With the MX release (6+), ColdFusion introduced the ''component'' language construct which resembles classes in OO languages. Each ''component'' may contain any number of properties and methods. One component may also extend another (inheritance). Components only support single inheritance. ColdFusion does not currently support Java-style interfaces, but does support Ruby-style mixins. ColdFusion components use the file extension cfc to differentiate them from ColdFusion templates (.cfm). It's also worth mentioning that due to the MX layered architecture, full OO support is available by embedding pure java into your CFML (similar to how JSPs also support embedding of Java). Component methods may be made available as web services with no additional coding and configuration. All that is required is for a method's access to be declared 'remote'. ColdFusion automatically generates a WSDL at the URL for the component thusly: Methods which are declared remote may also be invoked via a HTTP GET request. Consider the GET request as shown. This will invoke the component's search function, passing arguments "your query" and "strict" as arguments. The ColdFusion server will automatically generate documentation for a component if you navigate to its URL and insert the appropriate code within the component's declarations. This is an application of component introspection, available to developers of ColdFusion components. Access to a components documentation requires a password. MIXING COLDFUSION AND JAVA ColdFusion runs as a web application and can be deployed in a number of supported Servlet Containers , including Jakarta Tomcat , Macromedia JRun , and IBM WebSphere , and even on a .NET app server (New Atlanta). Because of ColdFusion's Java code-base, it is possible to mix Java classes with ColdFusion code to create a variety of applications and utilize existing Java libraries. ColdFusion has access to all the underlying Java classes, allowing usage of Java classes. ColdFusion also supports mixed usage of JSP custom tag libraries alongside CFML. Prior to ColdFusion 7.0.1, ColdFusion components could only be used by Java or .NET by declaring them as web services. However, beginning in ColdFusion MX 7.0.1, it is now possible to utilize ColdFusion components directly within Java classes using the CFCProxy class . CUSTOM TAGS ColdFusion provides several ways to implement custom tags, i.e. those not included in the core ColdFusion language. The traditional and most common way is using CFML. A standard CFML page can be interpretted as a tag, with the tag name corresponding to the file name prefixed with "cf_". For example, the file IMAP.cfm can be used as the tag "cf_imap". Attributes used within the tag are available in the ATTRIBUTES scope of the tag implementation page. CFML pages are accessible in the same directory as the calling page, via a special directory in the ColdFusion web application, or via a CFIMPORT tag in the calling page. The latter method does not necessarily require the "cf_" prefix for the tag name. A second way is the development of CFX tags using Java or C++. CFX tags are prefixed with "cfx_", for example "cfx_imap". Tags are added to the ColdFusion runtime environment using the ColdFusion administrator, where JAR or DLL files are registered as custom tags. Finally, ColdFusion supports JSP tag libraries from the JSP 2.0 language specification. JSP tags are included in CFML pages using the CFIMPORT tag. QUERY OF QUERIES ColdFusion uniquely supports query or queries, alternatively known as queries in memory. Given a variable of ''QUERY'' data type, ColdFusion can sort and retrieve selected rows from the result set using standard SQL. Note than in ColdFusion, a query datatype can be generated by methods other than standard database queries. For example, ColdFusion returns a query from a request to list the contents of a directory. For example:
Queries in memory often result in a performance improvement as the ColdFusion server does not have to query the database server multiple times. In the above example, only a single query of the file system was needed, saving processing overhead. ALTERNATIVE SERVER ENVIRONMENTS ColdFusion originated as proprietary technology based on Web technology industry standards. However, it is becoming a less closed technology through the availability of competing products. Products include New Atlanta's BlueDragon , IgniteFusion , Railo , Coral Web Builder and DigitalLattice Orange . In fact, one could now make the argument that ColdFusion is even less platform bound than say raw J2EE or .NET, simply because ColdFusion will run on top of a .NET app server (New Atlanta), or on top of any servlet container or J2EE application server (WebSphere, JBoss , Geronimo , Tomcat etc.) In theory, you could move a ColdFusion app unchanged from a J2EE app server to a .NET app server. Currently, alternative server platforms generally support ColdFusion MX 6.1 functionality, with minor changes or feature enhancements. ACRONYM The Acronym for the ColdFusion Markup Language is CFML. When ColdFusion templates are saved to disk, they are traditionally given the extension .cfm or .cfml. The .cfc extension is used for ColdFusion Components. The original extension was DBM or DBML, which stood for Database Markup Language. When talking about ColdFusion, most users use the Acronym CF and this is used for numerous ColdFusion resources such as user groups (CFUGs) and sites. CFMX is the common abbreviation for ColdFusion versions 6 and 7 (aka ColdFusion MX). CODE EXAMPLE Query your database: FROM table WHERE field = 'foo' Loop through your records: #field_from_query# Set and display a variable: Here is the contents of the variable: Define and use a function: Define a component (class): Instantiate a Java class: Dump the results of a query (for debugging):
Consume a web service: or SYNTAX CFML provides two different syntax formats for you to use, each with their own pros and cons. Tag-based Syntax CFML follows an XML/HTML-like syntax in that all commands are written in the format: Note that ColdFusion is not strictly XML because not all attributes have name value pairs and tags need not be well-formed. CFML more closely resembles HTML 4.0 syntax than XML. Since ColdFusion 6.0, the CFML syntax can almost entirely be expressed using XML format, with the key exception of CFIF/CFELSEIF/CFELSE tags. CFSCRIPT Syntax An additional syntax format is available that is similar to Javascript : command('argument 1', 'argument 2'); This second format provides a cleaner migration path for people with experience in C-style languages: C , C++ , Java , Javascript , etc. One thing to remember is that to use this syntax you ''must'' include the cfscript command around the code block -- you can't just launch into cfscript. Almost everything that can be done in tags can be done using CFSCRIPT. Some exceptions are:
Since the introduction of UDFs, however, it is possible to define a UDF using tag-based syntax that can be called from within cfscript blocks: from tblUser where userId = userData = readUserData(110, "myDataSource"); This allows the passing of arguments to tag-based constructs within cffunction blocks. Also, since ColdFusion MX 6.0 extended createObject() to include CFCs, it is possible to use both custom CFCs and Java objects in CFSCRIPT. Using Java objects to obtain access to protocol-based client functionality often defeats the whole purpose of using ColdFusion. Obviously, using CFCs or cffunction-based UDFs to provide script-style code access to the tag-based language features of ColdFusion is the preferred method. Generally, CFSCRIPT is used perform simple statements–such as multiple assignments–in lieu of multiple CFSET tags. CFSCRIPT can also be used to define UDFs: function addTwoNumbers(a,b) { return a+b; } In this case, however, it is impossible to define the content type detection that ColdFusion provides for arguments (string, numeric, query, struct, array, etc.), access restrictions on the UDF (public, private, package, remote), whether or not the UDF is allowed to generate output, or the return value content type (as with arguments). Using CFSCRIPT to define UDFs is handy for smaller tasks or simple things that aren't reliant on the various attributes that the CFFUNCTION and CFARGUMENT tags provide. CRITICISM Choices of scripting languages for any task are subject to much debate in the IT community. Criticisms of ColdFusion include:
DEVELOPMENT AIDES The following tools and frameworks are available: Development Tools / Environments
Code Frameworks
COLDFUSION FOCUSED PODCASTS
COLDFUSION FOCUSED MAGAZINES
TECHNICAL MAILING LISTS
EXTERNAL LINKS
|
|
|