An Introduction to ColdFusion MX

horseheadssolidInternet και Εφαρμογές Web

10 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

79 εμφανίσεις

An Introduction to ColdFusion MX

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

An Introduction to ColdFusion MX











Stephen Rittler

Manager, Philadelphia Area ColdFusion User Group

scrittler@etechsolutions.com

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com




What is ColdFusion?



ColdFusion MX architecture



A Quick Look at CFML



New and Enhanced features in MX




Please jump in with questions anytime!

Agenda

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com



ColdFusion is a proven rapid application
development system for the web, and is the
fastest way to integrate browser, server and
database technologies into powerful applications.




ColdFusion Markup Language is a great example
of encapsulation and abstraction at work.

What is ColdFusion?

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

The Role of ColdFusion

Web

Server

PC Browsers

COLDFUSION

MX

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

-------

Content


& Data

Database

Web services

Wireless Devices

CF
Templates

Other


Systems


74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

More on Java integration later…

ColdFusion Server Architecture





J2EE Infrastructure Services

ColdFusion MX Server

ColdFusion Scripting Environment

Charting and

Graphing

Full
-
Text

Search

Flash

Remoting

Web

Services

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

Operating Systems:


Windows, Linux (Red Hat and SuSE), Solaris, HP
-
UX, and
unofficially OS
-
X


Web Servers:

IIS 4 and 5, Apache 1.32 and 2.x, WebSite Pro, CFMX internal,
Netscape 3.6x, iPlanet 4.x and 6.x, Zeus 4.1


Application Servers:

JRun,SunONE, WebSphere, WebLogic (Q1’03)


Databases:

Any database with native, JDBC, or ODBC drivers

Platform support for ColdFusion

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

CFML:

-

is a tag
-
based scripting language comprised of 70+
tags and 300+ functions.

-

is easily integrated into standard HTML/XML/WML
documents

-

has a short learning curve

-

encapsulates very powerful functionality

-

is extensible using CFML, C++, Java,
JSP
,
Servlets



ColdFusion Markup Language

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<cfquery datasource=“myDSN” name=“people”>


SELECT *


FROM users


ORDER BY LastName

</cfquery>


<cfoutput query=“people”>


#LastName#, #FirstName#<br>

</cfoutput>



ColdFusion Code

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<%


Set people=Server.CreateObject("adodb.Recordset")


conn="DSN=myDSN"


sqlstmt = "SELECT * FROM users ORDER BY LastName"


people.open sqlstmt, conn


While not people.EOF



response.write(people("LastName") & ",")

response.write(people("FirstName") & "<br>")



people.moveNext


Wend


people.close()

%>


Same thing in ASP

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<%@ page import="javax.sql.*,java.sql.*,java.util.*" %>

<%

InitialContext context = getInitialContext();



ConnectionSource ds =
context.lookup("java:comp/env/jdbc/myDSN");



Connection conn = ds.getConnection();



RowSet people;


String sqlString = "SELECT * FROM users ORDER BY LastName“;


Statement stmt = conn.prepareStatement(sqlString);


people = stmt.execute();

%>

<% while (people.next()) { %>

<%= people.getString("LastName") %> ,


<%= people.getString("FirstName") %><br>

<%

}


conn.close();

%>

Same thing in JSP

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<CFSCRIPT> complements the tag
-
centric CFML
functionality with the ability to do tasks in pure
script on the server side.


Syntactically similar to JavaScript, but easier


No access to <CF*> functionality


Full access to ColdFusion variables in all scopes


Faster and simpler way to set variables and carry
out decision operations


Now has try() and catch() error handling!


[comparison.cfm]

CFSCRIPT

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<CFFUNCTION> is a new tag that extends the concept
of UDFs in <cfscript> to the tag arena.


Now we can write encapsulated functions that have
full access to all of CF’s functionality!


Most CF tags are not ported to functions for use
within CFSCRIPT blocks, BUT a sufficiently
enterprising developer could wrap the CFQUERY tag
inside a CFFUNCTION block…


Using CF Tags inside CFSCRIPT

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<CFFUNCTION name="wrapQuery">


<CFARGUMENT name="sqlString" required="true" type="string">


<CFQUERY datasource="PACFUG" name="dataset">



#arguments.sqlString#


</CFQUERY>




<CFRETURN dataset>

</CFFUNCTION>


<CFSCRIPT>


myRecordset = wrapQuery("SELECT * FROM tblRegisters");

</CFSCRIPT>


<cfdump var="#myRecordset#">

How to use CFQUERY in a CFSCRIPT block

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com


It was around this point when the engineers
designing MX realized that now that they could
provide access to all of the CFML tags and functions
inside of function calls.



The question was posed…why not group these tag
-
based functions together like we did with script
-
based functions?



These groupings appeared similar to Java classes.



And thus, ColdFusion Components were born.

Functions, Encapsulation…wait a sec!

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

Completely new functionality in CFMX!

FAR more to CFCs than we can cover here today (see
references at end of presentation)


30% faster than using custom tags


Groups of functions and properties


Code reuse and abstraction of common functionality


Brings pseudo
-
OO programming to ColdFusion


Can be called from CF, Flash, other app servers


Fast, easy way to do web services


SELF DOCUMENTING!

[User component]

ColdFusion Components

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

Flash Remoting represents new functionality that
allows Flash and the application server of your choice
to interact via HTTP.



Java, .NET, and CFMX


Can pass complex data types (recordset, struct)


Server side Action Script blurs line between

Flash and CF


Server components install separately from ColdFusion


Client components built in to Flash 6 Player


[SWF calling CFC based web service]

Flash Remoting

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

ColdFusion MX has much improved XML support and a
boatload of new functions to prove it!



Read and parse XML documents with XMLParse()


Create XML Documents with the <CFXML> tag; DOM
is automagically generated.


Transform XML documents using XMLTransform() and
an XSLT template.


Find information in XML documents using
XMLSearch() and XPath expressions


Send raw XML in a CFHTTP POST with

<CFHTTPPARAM type=“XML”…>

XML Support

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

CFMX Support for web services is:



XML tags and functions



ColdFusion Components



Automatic WSDL generation for exposed CFCs



<CFHTTP>, <CFINVOKE>, and <CFOBJECT> tags


WDDX was a spec released by Allaire/Macromedia in
1999 to “wrap” XML documents in a common format
before XML standards were agreed upon. It is still
used inside MX.


Web Services

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

<CFINVOKE> is a very versatile tag…



It can be used to Import JSP tag libraries

<cfimport taglib="/WEB
-
INF/lib/pennTags.jar" prefix="ben">




or to import “libraries” of Custom Tags

<cfimport taglib=“/taglib/pennCFM/” prefix=“franklin”>



or to import web services

<cfimport


webservice=“http://www.amazon.com/webservices/favories/”


prefix=“amazonSvc”>



or to create Adaptive tags

<cfimport taglib=“/taglib/modHTML/” prefix=“”>


A moment with CFINVOKE

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

ColdFusion has had Regular Expression support for
several releases. With CFMX, the RegEx engine is
now Perl
-
compatible.



More special characters and escape sequences
supported


Case conversion in result strings


POSIX character classes have always been supported



Regular Expressions

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com



ColdFusion has always included the Verity search engine
as part of the package.




MX includes the latest Verity engine : “K2”




Can index and search database content, files (DOC,
PDF, PPT, etc.), and web pages




FAST




K2 is expensive when purchased separately

Search Engine

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

Graphing in CFMX is improved



11 chart/graph types (8 are new) with 2 and 3
dimensional versions of each



Flash, JPG, or PNG format (no GIF)



More interactive display options than CFGRAPH



Multiple series



Ability to overlay different chart types



Charts can be cached to memory or disk



<CFGRAPH> and associated tags are deprecated



[PACFUG hit tracking example]

Charting and Graphing

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

CFMX features a built
-
in security mechanism




Roles
-
based



New Tags and Functions:


<cflogin> <cfloginuser> <cflogout>


IsUserInRole() GetAuthUser()



Server Sandbox security replaces SiteMinder


Lock
-
down tags, functions, databases, files,
directories and IP addresses and ports based on
directory


Security and Authentication

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com



Macromedia Studio MX has all sorts of hooks in to CFMX.


Contains Dreamweaver, Flash, Fireworks, FreeHand,
and CFMX Developer Edition.




Server
-
side debug, development



Developer tools are extensible!



References built right in



Consistent UI across apps



Wizards for component development



NetConnect Debugger in Flash for resolving Flash
Remoting issues



Development Tools

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

ColdFusion MX runs on top of a J2EE core…what does
that do for us?




CF templates are now “translated” into .java files
and compiled (caching still available)



Performance boost of about 10% on Win2k, 30% on
Solaris, and 40% on Linux



Proven J2EE foundation



J2EE session management (IIS caveat)



Permits CFMX to provide support for UNICODE
character set!



JRun is J2EE 1.3 compliant; version with CFMX Pro
is reduced functionality

CF/J2EE Architecture

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com

JSP tag libraries can be imported into, JSP pages can
be called from, and servlets can be invoked in
ColdFusion templates!




Can leverage existing Java applications (including
EJBs and Class files)



Grants the application another potential means for
separation of business logic from presentation logic


CF Developers do NOT have to learn Java to use
existing Java business components (meaning you save
money on consultants!)


JSP/Servlet Integration

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com



Feature Sets and Pricing

(NOTE:

Prices do NOT

Include Edu. Disc.)

ColdFusion MX Server Professional
Edition

$800/$549

ColdFusion MX Server Enterprise Edition

$5000/$2500

ColdFusion MX for J2EE Application
Servers

$3400

OS Support

Windows, Linux

Windows, Linux., Solaris, HP
-
UX

Windows, Linux, Solaris

Database Connectivity

ODBC, Desktop

SQL Server, mySQL

ODBC, Desktop,

SQL Server, mySQL, Oracle, DB2, Sybase,
Informix

ODBC, Desktop,

SQL Server, mySQL, Oracle, DB2, Sybase, Informix

Search

125,000 Documents

250,000 Documents

250,000 Documents

Adv.Deployment + Management





Load Balancing and Failover





Enhanced Java Integration

JTL Import/JSP Include

JTL Import/JSP Include

Server Sandbox Security





Deploy on leading J2EE app servers



Developer edition is free!

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com




ColdFusion MX brings far more functionality and power to the
table than any prior version.



Many, many CF community resources available for more info



Philadelphia Area ColdFusion User Group usually meets every
other month on the third Thursday at Penn State Delaware
County. Topics are on web development, databases, and CF.



PhillyJUG meets at Villanova, PhillyFlash meets @ UArts


Closing

74 Pottstown Pike | Suite 1000 | Eagle, PA 19480 | (610) 458
-
2460 | pacfug@etechsolutions.com



More Information:

http://www.macromedia.com/desdev/


http://livedocs.macromedia.com/cfmxdocs/


http://www.cfug
-
md.org/





(Rob Brooks
-
Bilson’s “Getting to know CFMX”)


http://www.systemanage.com/

(Charlie Arehart’s “CFMX Hidden Gems”)


http://www.pacfug.org/ (CFC presentation, plus our meetings!)




This Presentation:

“Introduction to ColdFusion MX”

http://www.pacfug.org/presentations.cfm

Links