Thursday, October 4, 2012

Railo Websockets Gateway Conflict with CFWheels

So, apparently, the Railo Websockets Gateway Extension conflicts with CFWheels.

The doc to get you started is at: http://wiki.getrailo.org/wiki/Extensions:WebSockets_Gateway#Sample_Apps

Which was giving me the error: "Gateway:my_websocket_gateway","key [WHEELS] doesn't exist in struct (keys:applicationname)"

Documented by another user here: http://code.google.com/p/cfwheels/issues/detail?id=860

The fix I found is similar, although less dramatic than "commenting out the $abortInvalidRequest();in both the events/onapplictionstart.cfm and also the events/onrequeststart.cfm allowed me to at get passed the point of the gateway not starting up."

I looked into the cfwheels code for  /wheels/global/internal.cfm --> $abortInvalidRequest  and, in my working copy, I've changed line 261 to not cause a 404 when the file in the calling path is from WebSocket.cfc, leaving wheels core functionality in place.

if ( (ListLen(callingPath, "/") GT ListLen(applicationPath, "/") || GetFileFromPath(callingPath) == "root.cfm" ) && ( GetFileFromPath(callingPath) != "WebSocket.cfc" )  )


Now.. on to WebSockets for Railo... I hope its more straight forward than having to compile java classes for Red5 ;-)

Friday, August 10, 2012

Coldfusion Session Tracker Object

I just discovered a fantastic blog post mentionning that Coldfusion (& Railo) have a java object that keeps track of sessions (that you can instantiate).. no more trying to count active sessions.


<cfset sessionTracker = createObject("java","coldfusion.runtime.SessionTracker")>
<cfdump var="#sessionTracker#">


Tuesday, July 10, 2012

CFWheels 1.1.8 Url Rewriting

CFWheels 1.1.8, IIS 7.5 on Win 7x64, Apache Tomcat running Railo 3.3

It seems url rewriting has been a tough nut to crack... and of course, now that I've figured it out... not so much :-)

- Add rewrite module to IIS 7.5 (Reboot your server.. I couldn't get the Rewrite module to show in the IIS control panel.)
- Enable rewriting by un-commenting out lines in your web.config that comes with cfwheels (This makes the rule appear in the IIS rewrite panel as a rule btw)

-  Review guide about rewrite configuration in IIS Console directly (nice for testing & understanding what's going on)
- Enable logging for starters (helpful) Hunt around in here for the log: C:\inetpub\logs\LogFiles\
- In tomcat's \tomcat\conf\web.xml 

Around line 429 "<!-- The mapping for the Railo servlet -->"   make sure this is NOT commented out:

<servlet-mapping>
    <servlet-name>GlobalCFMLServlet</servlet-name>
    <url-pattern>/rewrite.cfm/*</url-pattern>
</servlet-mapping>

Friday, July 6, 2012

Railo 4.0

Is it christmas? Is it my birthday? Nope... Railo 4.0 is in Beta, and the long list of new tweaks and features they've added are super exciting...and they've 'fixed' some things I had just learned to work around (such as the UPPERCASING of struct keys when the dot notation was used)

The most important of which, for me is the long awaited fix for URL Rewriting!!! I've known for a while now that the cgi.path_info param needed for url rewriting to work got lost between IIS and Railos connector. Railo 4 Beta Release

Read all about the new features: Railo 4 Beta Release Features

OWASP

OWASP Intro to XSS Attacks:


Thursday, June 7, 2012

Railo 3.3 on Jelastic.. socks officially blown off!

Wow. A one-click .war distribution on scalable hosting... this could be a game changer... Unfortunately:

- Jelastic doesn't use MS-SQL.. which means no management console. An alternative might be the fact that mySQL does have a GUI via workbench
- Jelastic uses Maven.. and has no support for Checkout only.. which means old-school ftp based updates for your site, instead of an svn-update to a specific version Railo In The Cloud  I'll let you know when they take my "good idea" and implement it :-)


Turning an email address into an image using ColdFusion ( Railo 3.3 )


I've come across the need to be able to render text in a browser (specifically, in this case an email address) that is not easily robot-readable, and is painless to show inline in the browser.

<cfset request.newImage = imageNew("",250,15,"rgb","white")>
 <cfset request.textRow1="email@email.com">
 <cfset attr = { font="SansSerif.plain", size="12", style="bold"}>
 <cfset imageSetDrawingColor(request.newImage,"black")>
 <cfset imageDrawText(request.newImage, request.textRow1, 0, 10, attr)>

 <cfimage action = "writeToBrowser"
   source = "#request.newImage#"  
   format="png"
isBase64="no"
 >

Thanks to: http://www.bjw.co.nz/developer/coldfusion/94-turning-an-email-address-into-an-image-using-coldfusion