A beginners guide to java integration in coldfusion
Download
1 / 19

a beginners guide to java integration in coldfusion - PowerPoint PPT Presentation


  • 209 Views
  • Uploaded on

A Beginners Guide to Java Integration in ColdFusion. Rick Root. Who Am I?. It just doesn’t seem right to have a slide with bullet points that prompt me to talk about myself. About This Session. Extend ColdFusion with “core” java Extend ColdFusion with external java libraries

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'a beginners guide to java integration in coldfusion' - johana


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Who am i l.jpg
Who Am I?

  • It just doesn’t seem right to have a slide with bullet points that prompt me to talk about myself.


About this session l.jpg
About This Session

  • Extend ColdFusion with “core” java

  • Extend ColdFusion with external java libraries

  • We will not talk about JVM tuning, writing CFX Custom Tags in Java, or writing your own Java classes.


Who are you l.jpg
Who Are You?

  • ColdFusion newbs

  • Never really used Java in ColdFusion

  • Just here for the networking



Using core java functionality l.jpg
Using Core Java Functionality

  • Java Objects

  • Data Types

  • Creating and Initializing Java Objects

  • JavaCast()

  • Examples


Java objects l.jpg
Java Objects

  • It all starts with java.langObject

  • Java objects have methods, so ColdFusion variables do to.

  • Example 1


Data types java vs cf l.jpg
Data Types – Java vs. CF

  • Strictly typed, very picky!

  • Don’t assume!

  • Example 2


Creating and initializing java objects l.jpg
Creating and Initializing Java Objects

  • In Java, create and initialize all at once, ie:foo = new ClassName(arguments)

  • In CF, use CreateObject() and init() methodfoo = CreateObject(“java”,”path.to.ClassName”); foo.init(arguments);

  • Multiple constructors / overloaded methods foo.init(“string”);foo.init(someint);


Javacast l.jpg
JavaCast()

  • Force a ColdFusion variable to be a specific data type

  • Example 3 & 4


String concatenation example l.jpg
String Concatenation Example

  • Object creation is expensive

  • Strings are immutable

  • Java StringBuffer object can help!

  • Example 5


Using third party libraries l.jpg
Using Third Party Libraries

  • Where to Install

  • Java Loader

  • Examples


Installing third party libraries l.jpg
Installing Third Party Libraries

  • Standalone: <cfroot>/lib

  • Multi-server Install, all instances: <jrunroot>/servers/lib

  • Multi-server install, specific Instance: <jrunroot>/servers/<instancename> /cfusion.ear/cfusion.war /WEB-INF/cfusion/lib

  • Anywhere you want!


Using javaloader l.jpg
Using JavaLoader

  • javaloader.cfc – Mark Mandel

  • Access classes without requiring them to be in the server CLASSPATH

  • Javaloader.riaforge.org

  • Example 6


Examples l.jpg
Examples

  • Generating Excel Files

  • Creating delimited text files

  • Extracting JPEG image metadata


Generating excel files l.jpg
Generating Excel Files

  • Apache POI – API to interface with Microsoft Office files

  • http://poi.apache.org

  • Create Excel files in native format

  • Use more Excel features

  • Example 7


Creating delimited files l.jpg
Creating Delimited Files

  • JavaCSV makes it easy

  • Choose your delimiter

  • Automatic quoting when data contains your delimiter or even newlines

  • Example 8


Extracting jpeg image metadata l.jpg
Extracting JPEG Image Metadata

  • Digital cameras store lots of metadata in captured images

  • Timestamp

  • Exposure

  • Camera model

  • Lots of stuff I don’t understand!

  • Example 9


Wrap up l.jpg
Wrap Up

  • Rick Root

  • [email protected]

  • http://www.opensourcecf.com/


ad