Getting%20to%20Know%20ColdFusion%20MX - PowerPoint PPT Presentation

About This Presentation
Title:

Getting%20to%20Know%20ColdFusion%20MX

Description:

CFDUMP VAR='#SERVER#' Enabling a Microelectronic World 2002 Amkor ... Auto generated structures like this can't be more than 3 levels deep: my.var.name ... – PowerPoint PPT presentation

Number of Views:199
Avg rating:3.0/5.0
Slides: 73
Provided by: sga1
Category:

less

Transcript and Presenter's Notes

Title: Getting%20to%20Know%20ColdFusion%20MX


1
Getting to Know ColdFusion MX
  • Rob Brooks-Bilson
  • Web Technology Manager
  • Author, Programming ColdFusion (OReilly)
  • 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
  • QA

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
ltwddxPacket version'1.0'gtltheader/gtltdatagtltarray
length'2'gtltstruct type'coldfusion.server.ConfigM
ap'gtltvar name'test'gtltstruct type'coldfusion.sche
duling.CronTabEntry'gtltvar name'path'gtltstringgtlt/st
ringgtlt/vargtltvar name'file'gtltstringgtlt/stringgtlt/var
gtltvar name'resolveurl'gtltboolean
value'false'/gtlt/vargtltvar name'url'gtltstringgthttp
//test.comlt/stringgtlt/vargtltvar name'publish'gtltbool
ean value'false'/gtlt/vargtltvar name'password'gtltstr
inggtlt/stringgtlt/vargtltvar name'operation'gtltstringgtH
TTPRequestlt/stringgtlt/vargtltvar name'username'gtltstr
inggtlt/stringgtlt/vargtltvar name'interval'gtltstringgtON
CElt/stringgtlt/vargtltvar name'start_date'gtltstringgt5/
9/2002lt/stringgtlt/vargtltvar name'http_port'gtltstring
gt80lt/stringgtlt/vargtltvar name'task'gtltstringgttestlt/s
tringgtlt/vargtltvar name'http_proxy_port'gtltstringgt23
lt/stringgtlt/vargtltvar name'proxy_server'gtltstringgtlt/
stringgtlt/vargtltvar name'start_time'gtltstringgt1024
15 PMlt/stringgtlt/vargtltvar name'request_time_out'gtlt
stringgtlt/stringgtlt/vargtlt/structgtlt/vargtlt/structgtltboo
lean value'false'/gtlt/arraygtlt/datagtlt/wddxPacketgt
11
Infrastructure Changes - Clustering
  • Hardware load-balancers are no longer supported
    within the CF Admin
  • Ciscos 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 and Obsolete Tags
  • 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

13
Deprecated and Obsolete Functions
  • 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

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
ltCFSET x 1 lt!--- I am valid ---gtgt ltCFSET y
DateFormat(Now(), 'mm/dd/yyyy' lt!--- I'm valid
too ---gt)gt ltCFSET z (1 2lt!--- still valid
---gt)gt ltCF_MyTag VAR"x" lt!--- I'm valid too
---gtgt ltCFOUTPUTgt ylt!---I'm valid as well,
although this looks weird---gt lt/CFOUTPUTgt ltH2gtOp
en the file Comments.cfm to see what I'm
doinglt/H2gt
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
ltCFSET VARIABLES.x1gt ltCFSET CALLER.y"test the
caller"gt ltCFDUMP VAR"VARIABLES"gt ltPgt ltCFDUMP
VAR"CALLER"gt ltPgt ltCFDUMP VAR"SERVER"gt
18
Language Changes Variable Names
  • Additional structure changes
  • Compound variable names delimited with periods
    now auto create structuresIn CF 5ltCFSET
    Employee.NameJoegtCreated 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 cant be more
    than 3 levels deep my.var.name

19
Example Auto Generating a Structure
ltCFSET Employee.Name "Joe Blow"gt ltCFSET
Employee.Age "30"gt ltCFDUMP VAR"Employee"gt
20
Language Changes Variables
  • Duplicate URL parameters now come across as a
    comma delimited list of values.
  • ?a2a2 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()
    functionltCFSET a12gtltCFSET b(105)32gt

21
Example Duplicate URL Variable Names
ltCFIF IsDefined('URL.a')gt altCFOUTPUTgtURL.alt/C
FOUTPUTgt ltPgt lt/CFIFgt ltCFOUTPUTgt ltA
HREF"CGI.Script_Name?a1a2"gtClick
melt/Agt lt/CFOUTPUTgt
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()
ltCFSET TheDate Now()gt ltCFOUTPUTgt TheDate
DateFormat(TheDate, 'mm/dd/yyyy') ltPgt These
formats are new in ColdFusion MXltBRgt short
DateFormat(TheDate, 'short')ltBRgt medium
DateFormat(TheDate, 'medium')ltBRgt long
DateFormat(TheDate, 'long')ltBRgt full
DateFormat(TheDate, 'full')ltBRgt lt/CFOUTPUTgt
24
Example TimeFormat()
ltCFSET TheTime Now()gt ltCFOUTPUTgt TheTime
TimeFormat(TheTime,'hhmmss tt')ltPgt ltPgt These
formats are new in ColdFusion MXltBRgt short
TimeFormat(TheTime, 'short')ltBRgt medium
TimeFormat(TheTime, 'medium')ltBRgt long
TimeFormat(TheTime, 'long')ltBRgt full
TimeFormat(TheTime, 'full')ltBRgt lt/CFOUTPUTgt
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 thisltCFIF
    IsDefined(URL.RequestTimeOut)gt ltCFSETTING
    REQUESTTIMEOUT URL.RequestTimeOutgtlt/CFIFgt

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 DBTYPEQuery
  • 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
  • Cant be used for query of queries
  • Cant 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
ltCFSET Colors ArrayNew(1)gt ltCFSET
Colors1"Red"gt ltCFSET Colors2"Silver"gt ltCFSET
Colors3"Blue"gt ltCFSET Products
QueryNew("ProductName, Color, Price,
Qty")gt ltCFSET NewRows QueryAddRow(Products,
2)gt ltCFSET QuerySetCell(Products, "ProductName",
"Widget", 1)gt ltCFSET QuerySetCell(Products,
"Color", Colors, 1)gt ltCFSET QuerySetCell(Products,
"Price", "19.99", 1)gt ltCFSET QuerySetCell(Product
s, "Qty", "46", 1)gt ltCFSET QuerySetCell(Products,
"ProductName", "Thingy", 2)gt ltCFSET
QuerySetCell(Products, "Color", Colors,
2)gt ltCFSET QuerySetCell(Products, "Price",
"34.99", 2)gt ltCFSET QuerySetCell(Products, "Qty",
"12", 2)gt ltCFDUMP VAR"Products"gt
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 ltgt 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
ltCFINCLUDE TEMPLATE"_TwosCompToDec.cfm"gt ltCFSET
flnm"d\cfusionmx\wwwroot\cfide\administrator\ima
ges\cfmx.gif"gt ltCFFILE ACTION"ReadBinary"
FILE"flnm" VARIABLE"TheFile"gt ltCFSET Width
TwosCompToDec((TheFile7) (TheFile8 256),
8)gt ltCFSET Height TwosCompToDec((TheFile9)
(TheFile10 256), 8)gt ltH2gtGIF
Dimensionslt/H2gt ltCFOUTPUTgt Width
WidthltBRgt Height HeightltBRgt lt/CFOUTPUTgt ltCFD
UMP VAR"TheFile"gt
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
ltCFSCRIPTgt try xy1 catch("Expression"
exception) writeOutput("Expression Error "
exception.Message) catch("Any"
exception) writeOutput("General Error "
exception.Message) lt/CFSCRIPTgt
36
Example For-in Loop over COM in CFScript
ltcfscriptgt fso CreateObject("COM",
"Scripting.FileSystemObject") for (i in
fso.drives) WriteOutput(i.DriveLetter
"ltbrgt") lt/cfscriptgt
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
ltCFSET String"I want to go to to the
park."gt ltCFOUTPUTgt From the CF DocsltBRgt REReplac
eNoCase(String, "(A-Za-z) \1","\1","ALL") lt
Pgt Should beltBRgt ReReplaceNoCase(String,
"\b(a-z) \1", "\1", "All") lt/CFOUTPUTgt
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 dont lock access to shared scope
    variables (application, session, server), CF MX
    wont 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, youll 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 ACTIONList. Returns query with names of
    all registered collections VDK and K2
  • ACTIONMap is no longer necessary as MX
    automatically detects mapped collections

45
Language Changes - Verity
  • Changes to CFINDEX
  • ACTIONOptimize 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

51
New Features Charting and Graphing
  • CFCHART offers the following
  • 11 chart/graph types with 2 and 3 dimensional
    versions of each
  • Flash, JPG, or PNG format (no GIF due to
    licensing issues)
  • More interactive display options than CFGRAPH
  • Multiple series
  • Ability to overlay different chart types
  • Charts can be cached to memory or disk

52
Example Super Basic CFCHART
ltCFQUERY NAME"GetSalary" DATASOURCE"ProgrammingC
F"gt SELECT Department, AVG(Salary) AS AvgSalary
FROM EmployeeDirectory GROUP BY
Department lt/CFQUERYgt ltCFCHART FORMAT"Flash"gt
ltCFCHARTSERIES QUERY"GetSalary" TYPE"bar"
VALUECOLUMN"AvgSalary"
ITEMCOLUMN"Department"gt
ltCFCHARTSERIES QUERY"GetSalary" TYPE"line"
VALUECOLUMN"AvgSalary"
ITEMCOLUMN"Department"gt
lt/CFCHARTgt
53
New Features UDFs
  • MX now supports tag based UDFs
  • Opens up a ton of new UDF possibilities
  • THREE new tags
  • CFFUNCTION
  • CFARGUMENT
  • CFRETURN
  • Local function variables are created with new
    Var attribute ltCFSET Var x1gt
  • Arguments is now available as an array AND a
    structure
  • Function parameters can now be named
    Person(NameJoe, Age30)

54
Example Tag based UDFs
ltCFFUNCTION NAME"IsScheduledTask"
RETURN"Boolean"gt ltCFARGUMENT NAME"TaskName"
REQUIRED"True" TYPE"String"gt lt!--- var local
vars for the func ---gt ltCFSET Var TaskXML""gt
ltCFSET Var GetTasks""gt lt!--- get the
scheduler xml file. It's stored as WDDX ---gt
ltCFFILE ACTION"Read FILE"Server.ColdFusion.Roo
tDir\lib\neo-cron.xml VARIABLE"TaskXML"gt
lt!--- convert the WDDX to CFML - and array of
structs ---gt ltCFWDDX ACTION"WDDX2CFML"
INPUT"TaskXML" OUTPUT"GetTasks"gt lt!---
search the array of structs for the name passed
to the func ---gt ltCFIF ListContainsNoCase(Struct
KeyList(GetTasks1), Arguments.TaskName) EQ 0gt
ltCFRETURN Falsegt ltCFELSEgt ltCFRETURN
Truegt lt/CFIFgt lt/CFFUNCTIONgt ltCFOUTPUTgtIs
"Test" a scheduled task? IsScheduledTask("test")
ltBRgt Is "Jest" a scheduled task?
IsScheduledTask("jest")lt/CFOUTPUTgt
55
New Features Native XML Handling
  • New XML Document Object data type
  • Builds a DOM using native ColdFusion data types
    such as arrays and structures
  • Can be manipulated with new XML functions,
    structure functions, and array functions
  • CFDUMP displays an extremely useful
    representation of the XML document object

56
Example XML Document Object
ltCFFILE ACTION"Read" FILE"d\cfusionmx\wwwroot\m
dcfug\MacromediaXmlFeed.xml" VARIABLE"MyXML"gt ltC
FSET DesDev XmlParse(MyXML)gt ltCFDUMP
VAR"DesDev"gt
57
New Features Native XML Capabilities
  • Read an existing XML file and convert it to an
    XML document object
  • Add,update, and delete elements and data from an
    XML document object
  • Transform XML document objects using XSLT
  • Search and extract data using Xpath
  • Generate XML files from XML document objects

58
New Features XML Tags and Functions
  • Tags
  • CFXML
  • Functions
  • IsXmlDoc()
  • IsXmlElement()
  • IsXmlRoot()
  • XmlChildPos()
  • XmlElemNew()
  • XmlFormat()
  • XmlNew()
  • XmlParse()
  • XmlSearch()
  • XmlTransform()

59
Example Manipulating XML
ltCFFILE ACTION"Read" FILE"d\cfusionmx\wwwroot\m
dcfug\MacromediaXmlFeed.xml" VARIABLE"MyXML"gt ltC
FSET DesDev XmlParse(MyXML)gt ltCFSET Size
ArrayLen(DesDev.Macromedia_Resources.XmlChildren)gt
ltCFSET MyQuery QueryNew("resource, title,
author, url, product") gt ltCFSET
QueryAddRow(MyQuery, Size)gt ltCFLOOP INDEX"i"
FROM"1" TO"Size"gt ltCFSET ThisProd ""gt
ltCFSET QuerySetCell(MyQuery, "resource",
DesDev.Macromedia_Resources.Resourcei.XmlAttribu
tes.Type, i)gt ltCFSET QuerySetCell(MyQuery,
"title", DesDev.Macromedia_Resources.Resourcei.
Title.XmlText, i)gt ltCFSET QuerySetCell(MyQuery,
"author", DesDev.Macromedia_Resources.Resourcei.
Author.XmlText, i)gt ltCFSET QuerySetCell(MyQuery,
"url", DesDev.Macromedia_Resources.Resourcei.U
rl.XmlText, i)gt lt!--- get the number of
products by looping over the entire XMLChildren
array and pulling out only product items. This
is necessary because an item can pertain
to more than one product. ---gt ltCFSET NumOfProd
ArrayLen(DesDev.Macromedia_Resources.XmlChildren
i.XmlChildren)gt ltCFLOOP INDEX"j" FROM"1"
TO"NumOfProd"gt ltCFIF DesDev.Macromedia_Reso
urces.XmlChildreni.XmlChildrenj.XmlName IS
"product"gt ltCFSET ThisProd
ListAppend(ThisProd, DesDev.Macromedia_Resources.
XmlChildreni.XmlChildrenj.XmlAttributes.Name)gt
lt/CFIFgt lt/CFLOOPgt lt/CFLOOPgt
ltCFDUMP VAR"MyQuery"gt
60
New Features - CFIMPORT
  • Four uses
  • Import JSP Tag Libraries
  • Import libraries of custom tags
  • Allows you to store and call your custom tags
    anywhere on the server
  • Allows custom prefixes
  • Import web services
  • Adaptive tags

61
New Features Adaptive Tags
  • Use CFIMPORT with PREFIX
  • Modify existing HTML/CFML tags to do new and
    interesting things

62
Example CFIMPORT and Adaptive Tags
ltCFIMPORT PREFIX"" TAGLIB"/mdcfug/adaptivetags"gt
ltBLINKgtFill me out!lt/BLINKgt ltFORM
MEDHOD"Post" ACTION"ltCFOUTPUTgtCGI.Script_Namelt
/CFOUTPUTgt"gt State ltINPUT TYPE"State"
NAME"State"gtltBRgt Name ltINPUT TYPE"Text"
NAME"Name" WIDTH"15" MAXLENGTH"255"gtltBRgt
ltINPUT TYPE"Submit" NAME"Submit"
VALUE"Submit"gt lt/FORMgt
63
New Features - CFCs
  • CFC ColdFusion Component
  • A lot more to them than we can cover here
  • CFCs are objects that allow pseudo
    object-oriented programming in CF MX
  • CFCs have methods you can call
  • Limited inheritance
  • Introspection
  • New variable scope in CFCs This
  • Use the CFCexplorer!

64
New Features - CFCs
  • New tags and functions for creating and working
    with components
  • CFCOMPONENT
  • CFFUNCTION
  • CFARGUMENT
  • CFPROPERTY
  • CFRETURN
  • CFINVOKE/CFINVOKEARGUMENT
  • CFOBJECT
  • GetMetaData()

65
New Features - CFCs
  • Can be called in a number of ways
  • CFINVOKE tag
  • CFOBJECT tag
  • CFSCRIPT (CreateObject)
  • URL
  • FORM
  • Flash Remoting
  • As a Web Service
  • To see what a CFC has to offer, enter its URL
    (secured by RDS password)

66
New Features - CFCs
  • CFC security is handled with the ROLES and ACCESS
    attributes
  • Roles specify WHO can access the CFC and
    correspond with roles defined within the CF
    security architecture
  • ACCESS specifies HOW the CFC can be accessed
  • Public
  • Private
  • Package
  • Remote

67
Example CFINVOKE a CFC
lt!--- call with CFINVOKE, filter on multiple
products, sort it, and return as a query
object ---gt ltcfinvoke component"GetDesDevFeed"
method"GetFeed" product"ColdFusion,Macromedi
a_Flash" lt!--- no space between items ---gt
sortOrder"Title DESC" returnVariable"MyQuery"gt
ltcfdump var"MyQuery"gt
68
New Features Web Services
  • CF MX has built in support for SOAP based web
    services via the Apache Axis server under the
    hood
  • Both production and consumption are supported
  • CFINVOKE/CFINVOKEARGUMENT or CreateObject() to
    consume
  • Set ACCESS to Remote in a CFC to produce its
    that easy!
  • WSDL file is automatically created when producing
    a web service
  • Web services can be registered in the CF Admin to
    avoid having to always specify the full path to
    the WSDL file

69
Example Invoking a Web Service
ltcfinvoke webservice"http//localhost8500/mdcf
ug/getdesdevfeed.cfc?wsdl" method"getFeed"
returnvariable"aQuery"gt ltcfinvokeargument
name"product" value"ColdFusion"/gt ltcfinvokeargu
ment name"author" value""/gt ltcfinvokeargument
name"resource" value""/gt ltcfinvokeargument
name"sortOrder" value""/gt lt/cfinvokegt ltCFDUMP
VAR"aQuery"gt
70
New Features Web Services
  • Security for web services is the same as that for
    CFCs
  • If you have Dreamweaver MX, there are all sorts
    of goodies for auto-generating code for producing
    and consuming web services in ColdFusion

71
Resources
  • MX Release Notes http//www.macromedia.com/suppor
    t/coldfusion/releasenotes/mx/releasenotes_mx.html
  • MX Doc Updates http//www.macromedia.com/v1/Hand
    lers/index.cfm?ID22811MethodFull
  • MX Doc Additions http//www.macromedia.com/v1/ha
    ndlers/index.cfm?id22993methodfull
  • MX LiveDocs http//livedocs.macromedia.com/cfmxd
    ocs/
  • Macromedia Designer Developer Center
    http//www.macromedia.com/desdev/mx/coldfusion/
  • CFLib.org http//www.cflib.org
  • CFCzone http//www.cfczone.org

72
QA
  • Feel free to email me questions at
    rbils_at_amkor.com
  • This presentation is available for download from
    http//www.cfug-md.org
Write a Comment
User Comments (0)
About PowerShow.com