<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development By George &#187; coldspring</title>
	<atom:link href="http://www.webdevelopmentbygeorge.com/category/coldspring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdevelopmentbygeorge.com</link>
	<description>ColdFusion, Flex, and JavaScript Programming</description>
	<lastBuildDate>Mon, 14 Nov 2011 20:45:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Coldfusion, Flex, and SSL</title>
		<link>http://www.webdevelopmentbygeorge.com/2011/05/26/coldfusion-flex-and-ssl/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coldfusion-flex-and-ssl</link>
		<comments>http://www.webdevelopmentbygeorge.com/2011/05/26/coldfusion-flex-and-ssl/#comments</comments>
		<pubDate>Thu, 26 May 2011 17:01:35 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[coldspring]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Model-Glue]]></category>

		<guid isPermaLink="false">http://www.webdevelopmentbygeorge.com/?p=239</guid>
		<description><![CDATA[So I want to start off this post by stating that I&#8217;m a computer programmer. I don&#8217;t consider myself a computer scientist, and I generally prefer my IDEs and other software just work. I don&#8217;t want to have to think too much about the configuration, etc. That being said, I have been itching to try [...]]]></description>
			<content:encoded><![CDATA[<p>So I want to start off this post by stating that I&#8217;m a computer programmer.  I don&#8217;t consider myself a computer scientist, and I generally prefer my IDEs and other software just work.  I don&#8217;t want to have to think too much about the configuration, etc.  That being said, I have been itching to try Flex for a long time.  I finally have an opportunity at work, and the process I had to go through to get it all working was daunting to say the least.  But now that I have it in place, everything seems to be going smoothly.</p>
<p>So here&#8217;s the situation, I work on a website that resides totally in SSL, it&#8217;s an application we&#8217;ve developed with some sensitive information in it, so I wanted to make sure everything stays in that realm.  Also, I used ColdSpring and Model-Glue (version 2, the sites been around a while now) to get it all running.  In order to use the Flash Builder 4.5 wizards to generate the RemoteObjects for ColdFusion, Flash Builder needs to do introspection.  I can&#8217;t find any other way to actually connect them together.</p>
<p>So the first thing that has to be covered is creating the RemoteObject using ColdSpring.  This isn&#8217;t as intuitive as I would have first thought, but didn&#8217;t seem too difficult.  You create a coldspring.aop.framework.RemoteFactoryBean and you have to make sure you instantiate it or else it doesn&#8217;t get created.  This just means a simple application.remoteFactory.getBean(&#8216;ServiceRemote&#8217;) call and you have your remote bean file.  All looks good.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ServiceRemote&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;coldspring.aop.framework.RemoteFactoryBean&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;target&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ref</span> <span style="color: #000066;">bean</span>=<span style="color: #ff0000;">&quot;Service&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;serviceName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ServiceRemote<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;beanFactoryName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>remotingBeanFactory<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;relativePath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/model/RemoteObjects/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;remoteMethodNames&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>method1,method2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The first problem then comes if you try to use the CFC Explorer to go to this file.  You&#8217;ll find that the CFCExplorer doesn&#8217;t trigger the application&#8217;s OnApplicationStart or anything else, so you don&#8217;t have your bean factory.  I&#8217;m not sure how others have handled this, but I added in a line like this to the bottom of my application.cfc:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> not <span style="color: #0000FF;">isDefined</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">'application.remotingBeanFactory'</span><span style="color: #0000FF;">&#41;</span> and <span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">FindNoCase</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">'cfcexplorer'</span>,CGI.SCRIPT_NAME<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">neq</span> <span style="color: #FF0000;">0</span> <span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfscript</span><span style="color: #0000FF;">&gt;</span></span>
		this.onApplicationStart();
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfscript</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>

<p>The second part of the CFIF being to keep that onApplicationStart from firing every time I went to it.</p>
<p>Now, this still didn&#8217;t seem to fix the whole problem, and I ended up finding this post on <a href="http://www.terrenceryan.com/blog/post.cfm/introspecting-applicationcfc">Application Introspection</a> by Terrence Ryan.  Boy did that help.  I have found that if I add it to the RemoteObject after generation, I get my cfcexplorer to fire up every time.  Like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> bfUtils <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">createObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;component&quot;</span>,<span style="color: #009900;">&quot;coldspring.beans.util.BeanFactoryUtils&quot;</span><span style="color: #0000FF;">&#41;</span>.init<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> test <span style="color: #0000FF;">=</span> new Application<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> not <span style="color: #0000FF;">len</span><span style="color: #0000FF;">&#40;</span>variables.beanFactoryName<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> bf <span style="color: #0000FF;">=</span> bfUtils.getDefaultFactory<span style="color: #0000FF;">&#40;</span>variables.beanFactoryScope<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfelse</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> bf <span style="color: #0000FF;">=</span> bfUtils.getNamedFactory<span style="color: #0000FF;">&#40;</span>variables.beanFactoryScope, variables.beanFactoryName<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>

<p>Now we get into the really fun stuff.  Thanks to Joshua Curtiss&#8217; post on <a href="http://blog.crankybit.com/flex-remoting-over-ssl/">Flex Remoting over SSL</a> I found that you have to make changes in the remoting-services.xml file in your flex folder in order to actually use the secure channel.</p>
<p>After that, if you&#8217;re doing your local development like I am with a self-signed certificate, you have to remember to import that certificate into the JVM keystore for your Flash Builder installation.  You can see some samples on this here:  <a href="http://www.java-samples.com/showtutorial.php?tutorialid=210">http://www.java-samples.com/showtutorial.php?tutorialid=210</a></p>
<p>The last step, is to make sure that your template file that you&#8217;re using is a .cfm instead of a .html when you&#8217;re running your testing.  Thanks to Mike Morearty&#8217;s ASP.NET example: <a href="http://www.morearty.com/blog/2006/12/11/changing-the-filenames-in-flex-builder-html-templates/">Changing the filenames in Flex Builder html templates</a>, I found this pretty simple too.  Just make sure you use a format of ${application}${build_suffix}.template.cfm for your CFM pages.  <del datetime="2011-05-26T18:42:32+00:00">And Flash Builder seems to launch in the html page anyway, so you could probably do a url relocate meta tag in that template to forward over to your cfm page and not have to change it every time you launch.</del></p>
<p>UPDATE: So if you add this line under the opening <head> tag in your index.template.html, it&#8217;ll launch your templated CFM page:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;meta HTTP-EQUIV=&quot;REFRESH&quot; content=&quot;0; url=${application}${build_suffix}.cfm&quot;&gt;</pre></td></tr></table></div>

<p>Pshew!  That was a lot of work to get introspection to work for your Data Service Objects.  But once you&#8217;re there, it does seem to come together very nicely!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevelopmentbygeorge.com/2011/05/26/coldfusion-flex-and-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DefaultProperties for ColdSpring Bean Factories</title>
		<link>http://www.webdevelopmentbygeorge.com/2009/06/29/defaultproperties-for-coldspring-bean-factories/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=defaultproperties-for-coldspring-bean-factories</link>
		<comments>http://www.webdevelopmentbygeorge.com/2009/06/29/defaultproperties-for-coldspring-bean-factories/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 18:13:35 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[coldspring]]></category>

		<guid isPermaLink="false">http://www.webdevelopmentbygeorge.com/?p=90</guid>
		<description><![CDATA[So I was playing with the defaultProperties configuration as mentioned on several sites, including this article by Dan Vega that got me going down the path. I wasn&#8217;t able to get it working at first, until I did a little messing around. Turns out that this: 1 2 3 &#60;entry key=&#34;devFilepath&#34;&#62; &#60;value&#62;${baseFilepath}logs&#60;/value&#62; &#60;/entry&#62; Won&#8217;t work. [...]]]></description>
			<content:encoded><![CDATA[<p>So I was playing with the defaultProperties configuration as mentioned on several sites, including this <a href="http://www.danvega.org/blog/index.cfm/ColdSpring">article by Dan Vega</a> that got me going down the path.  I wasn&#8217;t able to get it working at first, until I did a little messing around.  Turns out that this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;devFilepath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${baseFilepath}logs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Won&#8217;t work.  The ColdSpring engine won&#8217;t find this as a configuration to populate.  Instead, you have to make sure the whole space between the <value> tags is what you want to have replaced, like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;devFilepath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${devFilepath}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Hope that helps someone out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevelopmentbygeorge.com/2009/06/29/defaultproperties-for-coldspring-bean-factories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

