1 / 72

Getting to Know ColdFusion MX

Getting to Know ColdFusion MX. Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002 Presented to the MD CFUG http://www.cfug-md.org. Agenda. More than we can cover in 1 hour Getting started Infrastructure changes

adonai
Télécharger la présentation

Getting to Know ColdFusion MX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Getting to Know ColdFusion MX Rob Brooks-Bilson Web Technology Manager Author, Programming ColdFusion (O’Reilly) 05/21/2002Presented to the MD CFUGhttp://www.cfug-md.org

  2. Agenda • More than we can cover in 1 hour • Getting started • Infrastructure changes • Deprecated and obsolete tags/functions • Language changes • New features • Resources • Q&A

  3. Getting Started • Installation Planning • System requirements generally greater than CF 5 • Will only upgrade from CF 5 • Two installation options: • Standard • Removes CF 5 • Uses existing web server • Stand-alone • Uses internal web server • Port 8500 by defualt • Not recommended for production • Many config options in\CFusionMX\runtime\servers\default\SERVER-INF\jrun.xml

  4. Getting Started • Supported Operating Systems • Windows • 98 • ME (except CF Enterprise) • NT 4 • 2000 • XP • Linux • ReaHat 6.2-7.2 • SuSE 7.2-7.3 • Unix • Solaris 7, 8 • UPUX 11.00

  5. Getting Started • Supported Web Servers • CF MX internal web server • Apache 1.32x and 2.x • IIS 4 and 5 • Netscape 3.6x • iPlanet 4.x and 6.x • Zeus 4.1 (Linux SuSE) • Not officially supported – but it works! • WebSite Pro (forthcoming TechNote)

  6. Getting Started • Nervous about upgrading? • Initial install can be done “stand-alone”, allowing you to run CF 5 and CF MX on the same server • Point both CF 5 and CF MX to the same web root • When you are satisfied, you can reconfigure MX to use your web server instead • Code compatibility analyzer in CF Admin does a good job of identifying potential issues

  7. Infrastructure Changes - Java • ColdFusion MX is completely rewritten in Java • Ships with the Sun 1.3.1_03 JRE (1.3.1_01 on HP-UX) • You can also use the IBM JVM 1.2.2 or later • JDBC drivers for most popular databases • You can still use ODBC for DBs without JDBC drivers • J2EE under the hood • Now shipping • Professional and Enterprise (embedded JRun) • Available later this year • CF MX for J2EE App Servers • JRun (full version) • IBM WebSphere • BEA WebLogic • Sun One

  8. Infrastructure Changes - Java • CFML is compiled to Java byte code • Many operations execute faster than previous versions of CF • DB operations should perform about the same. JDBC is NOT inherently faster than ODBC • More access to underlying Java architecture – if you want it! • JSP pages • JSP tag libraries • Servlets • EJBs • Class files

  9. Infrastructure Changes - Registry • CF MX no longer uses the registry (Windows and *nix) to store config information. Majority is now in XML config files: • The XML is WDDX • Located in \CFusionMX\lib • Examples • Scheduled tasks: neo-cron.xml • DSN info: neo-query.xml • Verity info: neo-verity.xml

  10. Example: Neo-cron.xml <wddxPacket version='1.0'><header/><data><array length='2'><struct type='coldfusion.server.ConfigMap'><var name='test'><struct type='coldfusion.scheduling.CronTabEntry'><var name='path'><string></string></var><var name='file'><string></string></var><var name='resolveurl'><boolean value='false'/></var><var name='url'><string>http://test.com</string></var><var name='publish'><boolean value='false'/></var><var name='password'><string></string></var><var name='operation'><string>HTTPRequest</string></var><var name='username'><string></string></var><var name='interval'><string>ONCE</string></var><var name='start_date'><string>5/9/2002</string></var><var name='http_port'><string>80</string></var><var name='task'><string>test</string></var><var name='http_proxy_port'><string>23</string></var><var name='proxy_server'><string></string></var><var name='start_time'><string>10:24:15 PM</string></var><var name='request_time_out'><string></string></var></struct></var></struct><boolean value='false'/></array></data></wddxPacket>

  11. Infrastructure Changes - Clustering • Hardware load-balancers are no longer supported within the CF Admin • Cisco’s DFP supported via ClusterCATS • ClusterCATS updated for CF MX • For new features and configuration, see new Using ClusterCATS book in the CF Docs

  12. Deprecated (works now, but wont in future releases) CFGRAPH CFGRAPHDATA CFREGISTRY (*nix only) CFSERVLET CFSERVLETPARAM Obsolete (these no longer work in MX) CFINTERNALADMINSECURITY CFAUTHENTICATE CFIMPERSONATE CFINTERNALDEBUG CFNEWINTERNALADMINSECURITY Deprecated and Obsolete Tags

  13. Deprecated GetTemplatePath() ParameterExists() Obsolete AuthenticatedContext() AuthenticatedUser() CF_GetDataSourceUserName() CF_IsColdFusionDataSource() CF_SetDataSourcePassword() CF_SetDataSourceUserName() CFusion_DBConnections_Flush() CFusion_Disable_DBConnections() CFusion_GetODBCDSN() CFusion_GetODBCINI() CFusion_SetODBCINI() CFusion_Settings_Refresh() CFusion_VerifyMail() IsAuthenticated() IsAuthorized() IsProtected Deprecated and Obsolete Functions

  14. Language Changes - Comments • New comment rules • Within tags • Inside custom tag calls • Within function parameters (not inside string quotes) • Between pound signs • Nested comments

  15. Example: Comments <CFSET x = 1 <!--- I am valid --->> <CFSET y = DateFormat(Now(), 'mm/dd/yyyy' <!--- I'm valid too --->)> <CFSET z = (1 + 2<!--- still valid --->)> <CF_MyTag VAR="x" <!--- I'm valid too --->> <CFOUTPUT> #y<!---I'm valid as well, although this looks weird---># </CFOUTPUT> <H2>Open the file Comments.cfm to see what I'm doing</H2>

  16. Language Changes – Variable Scope Structs • New “scope” structures: • Variables (local) scope • Server • Caller (custom tags) • Use CFDUMP to see the contents of any of the scope structures • Be careful when calling variable names that are also scope structures such as URL, FILE, etc.

  17. Example: Variable Scope Structs <CFSET VARIABLES.x=1> <CFSET CALLER.y="test the caller"> <CFDUMP VAR="#VARIABLES#"> <P> <CFDUMP VAR="#CALLER#"> <P> <CFDUMP VAR="#SERVER#">

  18. Language Changes – Variable Names • Additional structure changes • Compound variable names delimited with periods now auto create structures:In CF 5:<CFSET Employee.Name=“Joe”>Created a variable called Employee.NameIn CF MX, it creates a structure called Employee and a key called Name with the value “Employee” • Auto generated structures like this can’t be more than 3 levels deep: my.var.name

  19. Example: Auto Generating a Structure <CFSET Employee.Name = "Joe Blow"> <CFSET Employee.Age = "30"> <CFDUMP VAR="#Employee#">

  20. Language Changes – Variables • Duplicate URL parameters now come across as a comma delimited list of values. • ?a=2&a=2 returns 1,2 in MX • In CF 5, only the last value is passed • Compound expressions can now be evaluated inline without the use of the Evaluate() function:<CFSET a=1+2><CFSET b=(10*5)+32>

  21. Example: Duplicate URL Variable Names <CFIF IsDefined('URL.a')> a=<CFOUTPUT>#URL.a#</CFOUTPUT> <P> </CFIF> <CFOUTPUT> <A HREF="#CGI.Script_Name#?a=1&a=2">Click me</A> </CFOUTPUT>

  22. Language Changes – Dates and Times • New Short, Medium, Long, and Full masks in DateFormat() and TimeFormat() • “gg” mask (era) is now supported in DateFormat() • Date functions support years in the range 100 AD – 9999 AD • Two digit years: • JRE and current locale determine how to process • For most locales, two digit years are processed relative to the current century. • Two digit years are interpreted to within 80 years before the current date and 20 years after. • Exceptions • Within 72 years before the current date, and 28 years after: English (Australian), English (New Zealand), German (Austrian), German (Standard), German (Swiss), Portuguese (Brazilian), Portuguese (Standard), Swedish.

  23. Example: DateFormat() <CFSET TheDate = Now()> <CFOUTPUT> TheDate = #DateFormat(TheDate, 'mm/dd/yyyy')# <P> These formats are new in ColdFusion MX:<BR> short: #DateFormat(TheDate, 'short')#<BR> medium: #DateFormat(TheDate, 'medium')#<BR> long: #DateFormat(TheDate, 'long')#<BR> full: #DateFormat(TheDate, 'full')#<BR> </CFOUTPUT>

  24. Example: TimeFormat() <CFSET TheTime = Now()> <CFOUTPUT> TheTime = #TimeFormat(TheTime,'hh:mm:ss tt')#<P> <P> These formats are new in ColdFusion MX:<BR> short: #TimeFormat(TheTime, 'short')#<BR> medium: #TimeFormat(TheTime, 'medium')#<BR> long: #TimeFormat(TheTime, 'long')#<BR> full: #TimeFormat(TheTime, 'full')#<BR> </CFOUTPUT>

  25. Language Changes - RequestTimeOut • RequestTimeOut URL parameter is no longer supported in MX • Instead, CFSETTING now has a REQUESTTIMEOUT parameter • Allows you to set timeouts on a page-by-page basis • Place in your Application.cfm for application wide setting • You can support “legacy” code like this:<CFIF IsDefined(‘URL.RequestTimeOut’)> <CFSETTING REQUESTTIMEOUT = “#URL.RequestTimeOut#”></CFIF>

  26. Language Changes - CFQUERY • TIMEOUT attribute is now in seconds and not milliseconds as in CF 5. Also applies to each part of query, not the whole operation. • CONNECTSTRING attribute is no longer supported due to JDBC issues. This means you can no longer make DSN-less connections. • DNNAME, DBSERVER, PROVIDER, and PROVIDERDSN are all obsolete • DBTYPE attribute is no longer supported except for DBTYPE=“Query” • CF now properly escapes single quotes in values passed to CFQUERY

  27. Language Changes - Query Objects • Query objects created manually (via QueryNew()) can contain complex data types as individual cell values • Can’t be used for query of queries • Can’t be saved to DB without first serializing compex data types into WDDX or other string format • Invalid names passed to QueryAddNew() now throw an error (CF 5 let them go)

  28. Example: Query Cell Containing an Array <CFSET Colors = ArrayNew(1)> <CFSET Colors[1]="Red"> <CFSET Colors[2]="Silver"> <CFSET Colors[3]="Blue"> <CFSET Products = QueryNew("ProductName, Color, Price, Qty")> <CFSET NewRows = QueryAddRow(Products, 2)> <CFSET QuerySetCell(Products, "ProductName", "Widget", 1)> <CFSET QuerySetCell(Products, "Color", Colors, 1)> <CFSET QuerySetCell(Products, "Price", "19.99", 1)> <CFSET QuerySetCell(Products, "Qty", "46", 1)> <CFSET QuerySetCell(Products, "ProductName", "Thingy", 2)> <CFSET QuerySetCell(Products, "Color", Colors, 2)> <CFSET QuerySetCell(Products, "Price", "34.99", 2)> <CFSET QuerySetCell(Products, "Qty", "12", 2)> <CFDUMP VAR="#Products#">

  29. Language Changes – Query of Queries • Improved performance • Orders of magnitude for many operations • Recommended upper limit for records is now 50,000 rows. CF 5 was 10,000 • Column aliases in ORDER BY, GROUP BY, and HAVING • Neither MX nor CF 5 support table aliases • Full support for LIKE • Arbitrary expressions can be: • Grouped • In aggregate functions • Additionally, arbitrary functions are allowed in aggregate functions

  30. Language Changes – Query of Queries • Upper() and Lower() scalar functions for case insensitive matching • Addition and subtraction can be performed on DATE types • Improved error messages • != may be used instead of <> for comparisons

  31. Language Changes - CFMAIL • New SPOOLENABLE attribute – two options • Yes (default): Copy of message is queued to disk until it can be sent. Same behavior as CF 5. • No: Messages are queued in memory until they can be sent • GROUP attribute now works correctly

  32. Language Changes – Binary • Binary strings are now represented as byte-arrays • You can use standard CF string functions for manipulating binary data without having to Base 64 encode • CFDUMP can dump the contents of binary objects, or you can use CFLOOP to iterate over the byte-array

  33. Example: Manipulating Binary <CFINCLUDE TEMPLATE="_TwosCompToDec.cfm"> <CFSET flnm="d:\cfusionmx\wwwroot\cfide\administrator\images\cfmx.gif"> <CFFILE ACTION="ReadBinary" FILE="#flnm#" VARIABLE="TheFile"> <CFSET Width = TwosCompToDec((TheFile[7]) + (TheFile[8] * 256), 8)> <CFSET Height = TwosCompToDec((TheFile[9]) + (TheFile[10] * 256), 8)> <H2>GIF Dimensions</H2> <CFOUTPUT> Width: #Width#<BR> Height: #Height#<BR> </CFOUTPUT> <CFDUMP VAR="#TheFile#">

  34. Language Changes - CFSCRIPT • Try/Catch exception handling added • Syntax a bit different than CFTRY/CFCATCH • Catch statements coded outside Try block • No CFCATCH structure. You get to define your own to hold error information • No CFTHROW or CFRETHROW equivalent • For-in loop can now be used to loop over COM collections

  35. Example: Try/Catch in CFScript <CFSCRIPT> try { x=y+1; } catch("Expression" exception) { writeOutput("Expression Error: " & exception.Message); } catch("Any" exception) { writeOutput("General Error: " & exception.Message); } </CFSCRIPT>

  36. Example: For-in Loop over COM in CFScript <cfscript> fso = CreateObject("COM", "Scripting.FileSystemObject"); for (i in fso.drives) { WriteOutput(i.DriveLetter &"<br>"); } </cfscript>

  37. Language Changes – Regular Expressions • MX Introduces a totally new regular expression engine • “Perl” compatible • More special characters and escape sequences • Case conversion in replacement strings • Minimal matching

  38. Example: Regular Expressions <CFSET String="I want to go to to the park."> <CFOUTPUT> From the CF Docs:<BR> #REReplaceNoCase(String, "([A-Za-z]+)[ ]+\1","\1","ALL")# <P> Should be:<BR> #ReReplaceNoCase(String, "\b([a-z]+)[ ]+\1", "\1", "All")# </CFOUTPUT>

  39. Language Changes - Unicode • CF MX Supports Unicode! • MX supports Java UCS-2 character code values in the range 0-65535 • CF 5 only supported characters in the range 1-255 • Character set support is a function of the underlying JRE • Default encoding is UTF-8

  40. Language Changes - Unicode • CFPROCESSINGDIRECTIVE tag can now set the encoding for a page • The most common character sets are UTF-8, UTF-16, UTF-16BE, UTF-16LE, US-ASCII, and ISO-8859-1 • You may use any character set supported by your JRE • Many tags and functions have a new CHARSET attribute/prameter • CFCONTENT • CFFILE • CFHTTP • ToBase64() • ToString() • UrlDecode() • UrlEncodedFormat()

  41. Language Changes – LS Functions • Locales are defined by your JRE • Locales may be different than in CF 5 • LSEuroCurrencyFormat() now only returns EUR as the currency symbol for locales that support it • LSCurrencyFormat() does not return EUR as the currency symbol for any locale – even those supporting the Euro • There are several other changes to LS functions. Consult the CF Docs for more info.

  42. Language Changes - Locking • Contrary to rumor, CFLOCK is not gone – just different • If you don’t lock access to shared scope variables (application, session, server), CF MX won’t experience the memory corruption that could occur in previous versions • However, race conditions as well as overwriting of values can still occur. • In many (most?) cases, you’ll continue to want to lock

  43. Language Changes - Verity • All Tags (CFCOLLECTION, CFINDEX, CFSEARCH): • Collection names may now contain spaces • New SearchEngine exception type is thrown when an error occurs with CFINDEX, CFCOLLECTION, and CFSEARCH

  44. Language Changes - Verity • Changes to CFCOLLECTION • ACTION is now required • New ACTION=“List”. Returns query with names of all registered collections – VDK and K2 • ACTION=“Map” is no longer necessary as MX automatically detects mapped collections

  45. Language Changes - Verity • Changes to CFINDEX • ACTION=“Optimize” is obsolete in MX • EXTERNAL attribute is no longer necessary as MX automatically detects mapped collections. Do not use it.

  46. Language Changes - Verity • Changes to CFSEARCH • Now allows fully qualified (absolute) path names in the COLLECTION attribute • EXTERNAL attribute is no longer necessary as MX automatically detects mapped collections. Do not use it.

  47. Language Changes - Verity • New K2 Server functions • GetK2ServerDocCount() • GetK2ServerDocCountLimit() • IsK2ServerABroker() • IsK2ServerOnline()

  48. New Features - CFHTTP • Can now post raw XML using new “XML” CFHTTPPARAM Type • New FIRSTROWASHEADERS attribute solves problem with first row in delimited file always being lost • CFHTTP follows a maximum of 4 redirects. CF 5 would follow up to 5 • Response headers return structures when multiple keys have same name. CF 5 returned arrays • Certain behaviors such as SSL support vary depending on your JRE • See the Release Notes for more info

  49. New Features - Security • Advanced Security (SiteMinder) is gone • Replaced with new security framework • Application based security • New tags • CFLOGIN • CFLOGINUSER • CFLOGOUT • New Functions • IsUserInRole() • GetAuthUser() • Sandbox Security • Lock-down tags, functions, databases, files, directoriesm and IP addresses and ports based on directory

  50. New Features – Charting and Graphing • CFGRAPH and CFGRAPHDATA are deprecated. • Still functional. However, may produce unexpected output. • Run the code compatibility analyzer in the CF Admin to find templates containing these tags • Replaced by CFCHART, CFCHARTSERIES, and CFCHARTDATA

More Related