Recent Articles

Java ME Development
Every time we purchase a cell phone, one of the first things we tend to do is find which games and applications were included in the phone. There is a certain level of excitement in discovering these micro applications. When you're interested in...

SpringOne Keynote And Interface21
During the opening day SpringOne keynote Interface21 explained how they plan on using the funding they recently secured. Later in the day, I spent a few minutes with Neelan Choksi, COO at Interface21.

JBoss And The Impact Of An 85% OSS Renewal Rate
Another tidbit that David Skok (JBoss VC) gave at OSBC was that the JBoss support renewal rate was 85% (likely at the time that JBoss was sold to Red Hat). It seems strange that a customer would buy support in...

Sun Comes Up W/ JavaFX In RIA Battle
Sun Microsystems today is announcing JavaFX which will take on Adobe's Flex/Flash/Apollo and Microsoft's Silverlight in the battle for rich internet applications developers. Since Adobe has a position of strength...

JBoss To Follow Fedora-RHEL Model
Before I get started, Red Hat/JBoss have the right & duty to their investors to grow revenue & profits as they see fit. I am certain that a good deal of thinking went into making this decision, especially to consider the customer impact. Here's a table that summarizes the likely...

Carving A Well Qualified Java Tiger Programmer
Sun Microsystems offers many certifications starting from programmer level to architect level. The latest version of the programmer (SCJP) exam is SCJP 5.0 - Sun Certified Programmer for the Java 2 Platform, Standard...

SCEA - Carving A Well Qualified J2EE Architect
Sun Microsystems offers many certifications starting from programmer level to architect level. SCEA (Sun Certified Enterprise Architect) certification is designed for enterprise architects responsible for building...


08.07.07


CFC's In ColdFusion 8 Use Java's Serialization API

By Pete Freitag

One of the handy new features in ColdFusion 8 is that CFC's are now serializable.

There isn't a whole lot of information about this new feature in the docs, but I did some playing around and it does appear that they have used Java's serialization API. This means that you can use java's java.io.ObjectOutputStream to serialize your CFC's...

Here's an example of how you might write serialize a CFC to a file:



You will now have a file called serialized_cfc.txt that you can open up. The file is actually a binary file, but you can read it with a text editor and see the values of your CFC instance variables inside this file.


Now suppose you want to read that file and reconstruct your CFC instance (deserialize it). We just use a FileInputStream and a ObjectInputStream:



Now suppose you didn't want to write the CFC instance to a file, but rather store it as a value somewhere else... We can use a ByteArrayOutputStream and then turn turn the Byte Array into a Base64 string.



Handy Stuff. Are there any functions or new features that I have missed that make this process any easier?

*Originally published at Pete Freitag's Homepage.


About the Author:
Pete Freitag (http://www.petefreitag.com/) is a software engineer, and web developer located in central new york. Pete specializes in the HTTP protocol, web services, xml, java, and coldfusion. In 2003 Pete published the ColdFusion MX Developers Cookbook with SAMs Publishing.

Pete owns a Firm called Foundeo (http://foundeo.com/) that specializes in Web Consulting, and Products for Web Developers.

About JavaProNews
JavaProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of Java environments. News and Advice for Java Professionals


JavaProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com



-- JavaProNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc. All Rights Reserved Privacy Policy Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


JavaProNews News Archives About Us feedback