COLDFUSION MX 7 ® Migrating Applications to ColdFusion MX 7
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered tradema
CONTENTS CHAPTER 1: Migrating Applications from ColdFusion 5 . .................... 5 Migrating to ColdFusion MX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Planning your migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Web server considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Migration strategy using external web server. . . . . . . . . . . . . . . . . . . . .
Tag and function examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Using ListSort in ColdFusion MX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Using the cfindex tag in ColdFusion MX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 CHAPTER 2: Changes in ColdFusion MX 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 1 Migrating Applications from ColdFusion 5 This chapter describes migration and known compatibility issues between ColdFusion Server 5 and later versions, including ColdFusion MX 6.1 and ColdFusion MX 7 (referred to in this chapter as ColdFusion MX). Contents Migrating to ColdFusion MX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Planning your migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Before planning your migration, make sure that you understand the ColdFusion MX configuration options: Server configuration Lets you install one instance of ColdFusion MX 7 with an embedded J2EE server. This configuration most closely resembles the ColdFusion MX base release and other releases prior to ColdFusion MX, such as ColdFusion 5 and ColdFusion 4.5. This was formerly known as the stand-alone configuration.
When running in the server configuration, ColdFusion MX uses the built-in web server, as follows: • The ColdFusion MX Administrator is located under the cf_root/wwwroot directory in a directory named CFIDE; CFM pages are located within the cf_root/wwwroot directory. • To access pages through the built-in web server, specify port 8500 in the URL, as the following example shows: http://localhost:8500/CFIDE/administrator/index.
5. Install ColdFusion MX on the test computer. The Install Wizard detects the previous version of ColdFusion and prompts you for the following: ■ Location of previous ColdFusion directory. ■ Location of CFIDE directory. ■ Whether to switch your web server from the previous ColdFusion version to ColdFusion MX. When using this migration strategy, it’s best to switch your web server to ColdFusion MX. 6. Open the ColdFusion MX Administrator.
4. Define data sources in the ColdFusion MX Administrator. If possible, do not run tests against a production database. 5. Copy CFM files to the cf_root/wwwroot (server configuration) or jrun_root/servers/coldfusion/ cfusion-ear/cfusion-war (multiserver configuration) directory. 6. Test the code in your application using the ColdFusion Code Compatibility Analyzer. For more information, see “Using the ColdFusion Code Compatibility Analyzer” on page 10. 7.
Using the ColdFusion Code Compatibility Analyzer To isolate compatibility issues between ColdFusion MX and ColdFusion Server 5, use the Code Compatibility Analyzer to check your ColdFusion pages.
Connecting to a data source with ODBC Socket In ColdFusion 5, an ODBC Data Source Name (DSN) entry that was created with the ODBC Data Source Administrator would automatically appear in the list of data sources in the ColdFusion Administrator. It does not appear automatically in ColdFusion MX; you must manually add the ODBC DSN entry. To manually add the ODBC DSN entry: 1. In the ColdFusion MX Administrator, select Data & Services > Data Sources. 2.
Localization and character handling This section describes the changes between ColdFusion 5 and ColdFusion MX that affect locale functions. It contains the following topics: • • • • Extended character code and encoding support Support for new currency formats Changes to formatting functions Other locale-specific changes Note: Results from localization functions might differ, depending on your Java Runtime Environment (JRE).
For more information on support for character encodings see the “Developing Globalized Applications” chapter in ColdFusion MX Developer’s Guide and the individual tag and function descriptions in the CFML Reference. Support for new currency formats ColdFusion MX recognizes new currency formats for locales. For example, when a euro currency is passed to the LSIsCurrency function, ColdFusion MX returns Yes if the locale is a Euro member, and No if not. Support for currency formats is JVM dependent.
Changes to formatting functions The following table outlines changes to formatting functions. For more information, see CFML Reference for the appropriate function. Function Description of change LSEuroCurrencyFormat In ColdFusion 5, the LSEuroCurrencyFormat function used EUR or the euro symbol (€) for every locale, even if the locale did not support the euro. For example, LSEuroCurrencyFormat(123.45, "international") returned "EUR123.45", even for an English (US) locale.
Function Description of change LSDateFormat In ColdFusion MX, LSDateFormat returns the appropriate date for the set locale. For example, LSDateFormat(12/01/02) returns Jan-12-2002 if the locale is set to English (UK), and Dec-01-2002 if the set locale is English(US). In ColdFusion 5, LSDateFormat throws an error or returns an incorrect format. When no mask is specified, ColdFusion MX returns the Java medium date format for the locale.
Function Description of change LSParseDateTime In earlier versions, you could not pass in a time-zone value such, as “EST”. Now you can, but ColdFusion MX processes this information as follows: • If the time zone specified in the date/time string parameter is different from the time zone setting of the computer hosting ColdFusion MX, ColdFusion MX changes the time value in the parameter to its equivalent value in the computer’s time zone.
Other changes This section describes other changes between ColdFusion 5 and ColdFusion MX. Advanced security ColdFusion MX provides a new and easy way for you to build user authentication and roles-based security into your applications. However, it is based on a completely different security model than ColdFusion 5. Also, ColdFusion MX no longer includes a licensed version of Netegrity Siteminder.
CFML data types ColdFusion MX preserves the case of a struct key, whereas ColdFusion 5 sets every struct key to uppercase. However, you cannot use dot notation with different case to create more than one key. For example, the following code produces one key, not two: x.Foo = 1; x.FOO = 2; If you specify x['Foo'], ColdFusion MX preserves case. However, for best results, use consistent case for struct key names.
So in ColdFusion MX, if the date is within 80 years before and 20 years after the date when it processes the date, then ColdFusion MX returns the date with the current century. Otherwise, it returns the previous century. In ColdFusion 5, if the date is within 71 years before and 29 years after the date when it processes the date, then ColdFusion 5 returns the current century. Otherwise, it returns the previous century. This can cause incompatible results.
Log files ColdFusion MX does not support the following ColdFusion 5 log files: • • • • • • • executive.log remote.log proxy.log cfadmin.log install.log server.stdout rdsservice.stdout Using cfform in a multihomed environment In ColdFusion 5, the cfform tag used inline JavaScript code for validation. In ColdFusion MX, cfform includes the CFIDE/scripts/cfform.js file, which contains all JavaScript.
Tag and function examples This section provides remedies for some of the compatibility issues listed in Chapter 3, “Tag and Function Changes.” Using cfregistry in ColdFusion MX The cfregistry tag is deprecated for UNIX and Linux platforms. Therefore, you must remove it on UNIX to avoid compatibility problems when migrating to a later version of ColdFusion MX.
Using the cfindex tag in ColdFusion MX To populate a collection with the contents of the query results, you can now use the cfindex tag with the query attribute and type = "file" or type = "path", for all actions that require information from the key attribute. You can also still use type = "custom". When you use type = "file" or type = "path" with a query, the action attribute queries to get filenames or file paths from the key attribute, and passes the query results to its actions.
CHAPTER 2 Changes in ColdFusion MX 7 This chapter describes functionality changes in ColdFusion MX 7. It does not include information on tag and function changes. For information on tag and function changes, see Chapter 3, “Tag and Function Changes.” Contents Configurations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Using cfform in a multihomed environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using cfform in a multihomed environment In ColdFusion 5, the cfform tag used inline JavaScript code for validation. In ColdFusion MX, cfform includes the CFIDE/scripts/cfform.js file, which contains all JavaScript. However, if your application runs in a hosted environment with multiple virtual websites, your virtual website may not contain a CFIDE directory, which causes JavaScript errors when using cfform.
Forms and validation enhancements If your application uses the cfform tag or server validation, ensure that you review the enhancement discussions in the Release Notes. In particular, rich forms (using Macromedia Flash) and skinnable forms (using XML) provide major enhancements to form display and processing. Improvements to the cfchart tag ColdFusion MX 7 includes the following enhancements to the cfchart tag: • • • • An updated charting engine provides improved output.
• The Verity search service consists of three separate processes: k2server k2index for searching for indexing k2admin for administration • Verity searches now return keyword scores for the alternate keywords returned in the Status structure. • Although the Verity search server is very similar to K2 functionality that was previously available in ColdFusion MX, the interface between ColdFusion and Verity has completely changed. For example, there no longer is a k2server.ini file.
• The following new functions enable access to SOAP headers in CFML clients and ColdFusion MX web services: ■ AddSOAPRequestHeader ■ AddSOAPResponseHeader ■ GetSOAPRequestHeader ■ GetSOAPResponseHeader ■ GetSOAPRequest ■ GetSOAPResponse ■ IsSOAPRequest For more information, see CFML Reference and ColdFusion MX Developer’s Guide. ColdFusion components (CFCs) You can now call super methods using named arguments. CFCs can now return arrays of CFC instances.
Support for strong encryption algorithms Additional parameters were added to the Encrypt and Decrypt functions after the ColdFusion MX 7 manuals went sent to the printer. These changes make it possible to interact with password-based encryption algorithms and other advanced encryption technologies.
ColdFusion MX 7 includes the following new or modified XML functions, parameters, and attribute: • • • • • • • • • • IsXML IsXMLAttribute IsXMLDoc IsXMLElem IsXMLNode IsXMLRoot XmlGetNodeType XmlNew XmlParse validator attribute XmlValidate Additionally, ColdFusion MX 7 includes support for specifying a document path or URL, including a relative URL, in the XMLParse xmlText attribute. Sandbox security Sandbox security lets you secure the CreateObject function by type.
Data source changes The cfsnippets, CompanyInfo, and CFExamples data sources have been combined into the cfdocexample data source. This database includes all tables from the previous three data sources. It is provided to support the ColdFusion documentation code examples and does not necessarily represent best practices in database design (for example, there is an employee table and an employees table). For more information on these changes, see CFML Reference.
Crystal Reports integration ColdFusion MX 7 supports Crystal Reports versions 9 and 10. Additionally, ColdFusion MX 7 now uses the RDC technology from the Crystal Reports API. You must install Crystal Reports with the following options: • Enable export to disk • Enable export to HTML Crystal Reports does not enable this options by default, so you must use the Custom Install option when installing Crystal Reports.
Other installation and configuration changes The following changes have been made to ColdFusion configuration: • In the server configuration, the server name is coldfusion (cf_root/runtime/servers/coldfusion). In ColdFusion MX 6.1, the server name was default (cf_root/runtime/servers/default).
CHAPTER 3 Tag and Function Changes This chapter describes tag and function changes, by release, starting with the base ColdFusion MX release. Contents Tag changes since ColdFusion 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Function changes since ColdFusion 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
New tags, attributes, values, and changes This table lists tags, attributes, and attribute values that have been added since the ColdFusion MX release: Tag Attribute or value Added in this Comment ColdFusion release cfapplication scriptProtect attribute ColdFusion MX 7 setDomainCookies attribute cfargument cfcache Previously, enabling this attribute caused CFID and CFTOKEN to use domainwide cookies. Now it also causes client scope with cookies to use domainwide cookies.
Tag Attribute or value Added in this Comment ColdFusion release cfcache action="flush" attribute ColdFusion MX cfcalendar All ColdFusion MX 7 cfcatch Changes ColdFusion MX (continued) The action="flush" attribute now correctly expires a cached page in the server, the client, or both locations. The cfcache.map file now contains the template name and source timestamp. The cfcatch.
Tag Attribute or value Added in this Comment ColdFusion release cfchart style , title attributes ColdFusion MX 7 xAxisType, yAxisType ColdFusion MX 6.
Tag Attribute or value Added in this Comment ColdFusion release cfcomponent style, namespace, serviceportname, porttypename, wsdlfile, and bindingname attributes ColdFusion MX 7 Extended functionality for the hint and displayname attributes when publishing document-literal style web services All ColdFusion MX cfcontent variable attribute ColdFusion MX 7 cfdirectory recurse attribute for list and delete actions ColdFusion MX 7 Changes ColdFusion MX (Windows) This tag no longer returns rows fo
Tag cffile Attribute or value Added in this Comment ColdFusion release result attribute for upload ColdFusion MX 7 action fixnewline attribute for action="append" and action="write" cfform Change ColdFusion MX When assigning the attributes, the file’s Archive attribute is always set. name and action attributes ColdFusion MX 7 The name and action attributes are optional. ColdFusion MX ColdFusion MX only uses the cfinput tag’s checked attribute if the corresponding form field value is undefined.
Tag Attribute or value Added in this Comment ColdFusion release cfformgroup All ColdFusion MX 7 cfformitem All ColdFusion MX 7 cfftp result attribute ColdFusion MX 7 Change ColdFusion MX description attribute xml value for returnType attribute ColdFusion MX 7 All ColdFusion MX cffunction cfgrid ColdFusion MX 7 format attribute and support for Flash and XML output enabled, onChange, style, tooltip, visible attributes (Flash format only) cfgridcolumn mask attribute The cfformgroup discu
Tag Attribute or value Added in this Comment ColdFusion release cfhttp result attribute ColdFusion MX 7 Changes ColdFusion MX 6.1 The timeout attribute requires the Java Development Kit (JDK) version 1.4. Otherwise, ColdFusion MX ignores this attribute. The cfhttp tag had many enhancements in ColdFusion MX 6.1. For more information, see CFML Reference.
Tag Attribute or value Added in this Comment ColdFusion release cfindex custom3, custom4, category, ColdFusion MX 7 and categorytree attributes for update and refresh actions status attribute for Update, Refresh, Delete, Purge actions language attribute Change cfinput New values. For more information, see CFML Reference. ColdFusion MX You can use the query attribute and type="file" or type="path", for all actions that require information from the key attribute.
Tag Attribute or value Added in this Comment ColdFusion release cfinput src attribute (image only) ColdFusion MX 7 servicePort attribute for web services ColdFusion MX 7 All ColdFusion MX omit attribute ColdFusion MX 7 All ColdFusion MX returnAsBinary attribute ColdFusion MX 7 Changes ColdFusion MX (continued) cfinvoke cfinvokeargument cfldap You can no longer sort cfldap query results on the client side using the sort attribute. The sort attribute triggers a server-side sort.
Tag Attribute or value Added in this Comment ColdFusion release cfldap (continued) referral attribute ColdFusion MX If the referral attribute is selected, cfldap returns the name of the referred server before the results. For example, if the referred server is server1.rnd.anytown.anyc orp.com:123, the results could look like the following: DN:ldap:// server1.rnd.anytown.anyc orp.
Tag Attribute or value Added in this Comment ColdFusion release cfmail spoolEnable attribute ColdFusion MX charset, failto, replyTo, userName, password, wrapText attributes ColdFusion MX 6.1 The cfmail tag had many enhancements in ColdFusion MX 6.1. For more information, see the ColdFusion documentation. Change ColdFusion MX ColdFusion MX formats undeliverable mail differently than in ColdFusion 5. If you have any custom code that relies on this format, you must change it.
Tag Attribute or value Added in this Comment ColdFusion release cfprocparam Changes ColdFusion MX The maxrows attribute is obsolete in ColdFusion MX. If you have ref cursors in packages or stored procedures, use cfprocresult instead. This causes Datadirect JDBC to place the Oracle ref cursors into a result set. Note: you cannot use this method with the Oracle ThinClient JDBC drivers. ColdFusion MX ignores the dbvarname attribute for all drivers.
Tag Attribute or value Added in this Comment ColdFusion release cfquery result attribute ColdFusion MX 7 Change Changes When running in a locale other than US or Japanese, cfquery always returns date fields in numeric format; for example, 12.13.52 or 3:30PM. ColdFusion MX ColdFusion MX disallows SQL reserved words as variable or column names in a Query of Queries, unless they are escaped.
Tag Attribute or value Added in this Comment ColdFusion release cfreport template, format, name, filename, query, overwrite , permissions, encryption, ownerpassword, and userpassword attributes ColdFusion MX 7 Changes ColdFusion MX cfreportparam All ColdFusion MX 7 cfsearch category, categoryTree, status, suggestions, contextPassages, contextBytes, contextHighlightBegin, contextHighlightEnd, previousCriteria ColdFusion MX 7 This tag no longer manages the data connection for a Crystal report.
Tag Attribute or value Added in this Comment ColdFusion release cfswitch Change ColdFusion MX You can no longer have code inside a cfswitch tag that is not in a cfcase or cfdefaultcase tag. ColdFusion 5 erroneously ignores the code, whereas ColdFusion MX correctly throws a compiler error. cftable header attribute changed ColdFusion MX If you use the cftable header attribute without any text, ColdFusion MX displays the header as true. ColdFusion 5 displays the header as TRUE.
Deprecated tags, attributes, and values The following tags, attributes, and attribute values are deprecated. Do not use them in ColdFusion applications. They might not work, and might cause an error, in releases later than ColdFusion MX. Tag Attribute or value Deprecated as of this ColdFusion release cfcache cachedirectory, timeout attributes. ColdFusion MX Use the directory and timespan attributes instead.
Tag Attribute or value Deprecated as of this ColdFusion release cfsearch external, language attributes ColdFusion MX cfselect passthrough attribute ColdFusion MX 7 cfservlet All ColdFusion MX cfservletparam All ColdFusion MX cfslider img, imgStyle, grooveColor, refreshLabel, tickmarkimages, tickmarklabels, tickmarkmajor, tickmarkminor attributes ColdFusion MX cfstoredproc connectString, dbName, dbServer, dbtype, provider, providerDSN ColdFusion MX attributes cftextinput All ColdFusion
Tag Attribute or value Obsolete as of this ColdFusion release cfprocparam maxrows attribute ColdFusion MX cfsetting catchExceptionsByPattern ColdFusion MX attribute Function changes since ColdFusion 5 The following tables list functions, parameters, and values that have changed since ColdFusion 5 and indicate the specific release in which the change was made. Each change might affect code that was written for a previous release. In particular, these changes might affect ColdFusion 5 applications.
Function Parameter, value, or change Added in this ColdFusion release DateAdd L key of ColdFusion MX 6.1 Comment datepart parameter DateDiff Change ColdFusion MX In ColdFusion 5, there is one less second in a minute when calculating a negative difference. For example, it returns 60 seconds between 03:44:23 and 03:45:23, but -59 seconds between 03:45:23 and 03:44:23.
Function Parameter, value, or change Added in this ColdFusion release GetContextRoot All ColdFusion MX 7 GetEncoding All ColdFusion MX GetLocale Change ColdFusion MX GetLocaleDisplayName All ColdFusion MX 7 GetMetaData All ColdFusion MX GetPageContext All ColdFusion MX GetProfileSections All ColdFusion MX GetSOAPRequest All ColdFusion MX 7 GetSOAPRequestHeader All ColdFusion MX 7 GetSOAPResponse All ColdFusion MX 7 GetSOAPResponseHeader All ColdFusion MX 7 GetTempDirector
Function Parameter, value, or change Added in this ColdFusion release Comment IsWDDX Change ColdFusion MX This function returns No for arrays and other complex values. ColdFusion 5 returns an error. ColdFusion MX and ColdFusion 5 accept a basic value, such as a string, number, logical value, or date and time value.
Function Parameter, value, or change Added in this ColdFusion release Comment LSCurrencyFormat Changes ColdFusion MX This function returns a negative number when passed a negative number. With the local argument, this function returns the currency in the locale’s standard format, such as £ for pounds in the English (UK) locale. With the international argument, this function returns the currency with its international currency code, such as AUD for the Australian dollar.
Function Parameter, value, or change Added in this ColdFusion release Comment REFind REReplace REFindNoCase REReplaceNoCase Changes ColdFusion MX These functions exclude questionable punctuation, such as +, $, and =, in the [[:punct:]] class of regular expression functions. These functions recognize accented letters in the appropriate character classes, such as :upper:, :lower:, :alpha:, and so on.
Function Parameter, value, or change Added in this ColdFusion release Comment REReplace REReplaceNoCase Changes ColdFusion MX In replacement strings, the following character pairs now represent case conversion codes: \E, \l, \L, \u, and \U. If your ColdFusion 5 application has a replacement string with one of these character pairs, escape it by prefixing it with a backslash; for example, \\u. To include special characters for backrefs (\1), prefix them with an additional blackslash; for example, \\1.
Function Parameter, value, or change Added in this ColdFusion release XmlElemNew namespace ColdFusion MX 7 Comment parameter XmlGetNodeType All ColdFusion MX 7 XmlNew All ColdFusion MX XmlParse All ColdFusion MX XmlParse validator ColdFusion MX 7 parameter XmlSearch All ColdFusion MX XmlTransform All ColdFusion MX XmlTransform parameters parameter ColdFusion MX 7 XmlValidate All ColdFusion MX 7 Deprecated functions, parameters, and values The following functions, parameters, a
Obsolete functions, parameters, and values The following functions, parameters, and values are obsolete. Do not use them in ColdFusion applications. They do not work in releases later than ColdFusion 5.
Chapter 3: Tag and Function Changes