Recent Entries
Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
You may also be interested in...
Web Hosting

<< October, 2009 >>
SMTWTFS
123
45678910
11121314151617
18192021222324
25262728293031
Search Blog

Recent Comments
Re: November 7th, 2012 - Day 1 of the Restoration of America's Greatness (by dougboude at 5/04 9:47 AM)
Re: November 7th, 2012 - Day 1 of the Restoration of America's Greatness (by Simon Magnus at 5/04 9:24 AM)
Re: Providing for Service Layer Objects in CFWheels: Hello Wirebox! (by Brad at 5/03 11:37 AM)
Re: PayPal IPN Coldfusion CFC (by No at 4/29 9:28 AM)
Re: Java: The Journey Begins (by jwilliam at 4/23 11:56 PM)
Re: Providing for Service Layer Objects in CFWheels: Hello Wirebox! (by geirman at 4/21 10:24 AM)
Re: Providing for Service Layer Objects in CFWheels: Hello Wirebox! (by dougboude at 4/20 11:32 AM)
Re: Providing for Service Layer Objects in CFWheels: Hello Wirebox! (by geirman at 4/20 10:27 AM)
Re: The Model-Glue Event Lifecycle in Layman's Terms (by Ashwini at 4/18 2:51 PM)
Re: Viewing Option Text (in IE7) that's Wider than the Select List (by cormac at 4/18 4:18 AM)
Re: Providing For Service Layer Objects in CFWheels (by Chris Geirman at 4/16 2:04 PM)
Re: Why Provide for Service layer objects in CFWheels? (by dougboude at 4/13 9:13 AM)
Re: Why Provide for Service layer objects in CFWheels? (by Eric Cobb at 4/13 8:26 AM)
Re: Why Provide for Service layer objects in CFWheels? (by Chris Geirman at 4/13 6:44 AM)
Re: Why Provide for Service layer objects in CFWheels? (by Per Djurner at 4/12 3:39 PM)
Re: Refreshing Cached ColdFusion Webservices Through the Back Door (by Paul at 4/11 3:26 PM)
Re: Adding and Customizing Mura Editor Styles (by dougboude at 4/05 3:54 PM)
Re: Adding and Customizing Mura Editor Styles (by mike at 4/05 2:28 PM)
Re: Adding Mura Components to a Page Without Cascading (by Suzy Naschansky at 3/28 10:38 AM)
Re: Adding Mura Components to a Page Without Cascading (by Suzy Naschansky at 3/28 4:36 AM)
Categories
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

20 October 2009
Adding a Railo Site in W2k8/IIS7/Tomcat Environment

I took the time to document the steps I went through when adding a new Railo-enabled IIS7 site, so thought I'd share them. This brief tutorial assumes that you have already previously installed Railo in this environment and that the site you are creating has either its own domain or subdomain name. My specific scenario is that I'm using Railo 3.1x on Windows Standard Server 2008 with IIS7 and Tomcat 6. You may have to adjust some of the steps to fit your particular environment.

Adding a New Railo Site

1. Create a new site in IIS

    a.create a folder that will be the root of your new site;

    b. Add the site in IIS and point it to the folder you created above;

add web site in iis7

2. Create a small test.html page and drop it in to your new site's root

3. add the new site name to either your HOSTS file or your DNS (if you manage that yourself)

edit hosts file

4. Open a browser and browse to your test.html file, just to test things up to this point.

testing hello world

5. Add a virtual directory to your site called "jakarta" that points to the folder in which your isapi_redirect-1.2.28.dll (or equivalent) redirector resides. (if you don't know what the redirector is, you may need to visit the prior tutorials on installing Railo the first time.)

add virtual directory iis7

6. Add an ISAPI filter to your site that points to the redirector DLL mentioned in the previous step

add isapi filter iis7

7. Restart the site in IIS

8. Create a small test CFM template in your site's root

9. Add a HOST entry to your Tomcat6/conf/server.xml file

add host entry server xml tomcat

10. Restart Tomcat (you'll now notice that a WEB-INF folder was created in your new site's root! This is a very good sign)

restart Tomcat windows

restart Tomcat

web-inf folder railo added

web-inf folder was added automatically!

11. Browse to your test CFM template. You should be having success at this point!

test cfm template

Posted by dougboude at 12:11 PM | PRINT THIS POST! | Link | 8 comments



05 October 2009
Weird 404 Error on IIS7 When Accessing Flat File

We recently migrated a site from a freeBSD environment to a Windows environment. This morning accounting shared an error with me they were receiving when trying to access a system generated flat file. Typically, they select a few options and click a button, and are then presented with a page that contains a link to the generated flat file. Their process is to then right click the link and perform a "save target as" action. Now, however, right clicking the link and choosing 'save target as' produced a 404 error.

 I first suspected that perhaps there was an issue with pathing since obviously 404 indicates a file not found. Going in the back door, though, there the file sat in all its glory, and with all the content it should have had.

Turns out that the real issue was the fact that IIS7 did not have a clue as to the mime type of the file generated. The previous developer had been quite fond of using the ".dat" extension when generating flat files, and, although the code was creating the file just fine, when attempting to navigate to it for a "save target as" action IIS7 didn't have a clue what to do with it. I would have thought IIS might have defaulted to a mime type of text, but instead it just pretended the file didn't exist.

The solution: add ".dat" to the list of mime types for that particular site, with a type of "text/plain".

Posted by dougboude at 10:16 AM | PRINT THIS POST! | Link | 1 comment
02 October 2009
Security Snippet for canvasWiki

I spent two days waiting to see if anybody would respond to my call for "code donations" regarding adding real security to canvasWiki, but no code came flying my way. Of course, in that time I could have just written my own, but I was being lazy. I did end up having to do it myself, though, so thought I'd share in case it saves someone else time later.

My security is based on a user having n roles. Since canvas is hard coded for sysop, admin, user, and all (via the "RoleList" parameter in the CanvasConfig bean in Coldspring.xml) those are the roles I used as well.

Table scripts (mysql):
user table

CREATE TABLE `user` (
`userid` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(35) NOT NULL,
`lastname` varchar(35) NOT NULL,
`username` varchar(35) NOT NULL,
`password` varchar(35) NOT NULL,
PRIMARY KEY (`userid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
INSERT INTO `user` (`userid`, `firstname`, `lastname`, `username`, `password`) VALUES
(1, 'doug', 'boude', 'dougboude', 'mamamiarocks'),
(2, 'suzy', 'queue', 'squeue', 'ihearthuckabees');

 

 

 roles table

CREATE TABLE `roles` (
`roleid` int(11) NOT NULL AUTO_INCREMENT,
`rolename` varchar(35) NOT NULL,
`description` varchar(75) DEFAULT NULL,
PRIMARY KEY (`roleid`)) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
INSERT INTO `roles` (`roleid`, `rolename`, `description`) VALUES
(1, 'sysop', NULL),
(2, 'admin', NULL),
(3, 'user', NULL);

 

 

 junction table

CREATE TABLE `jctuserrole` (
`userid` int(11) NOT NULL,
`roleid` int(11) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `jctuserrole` (`userid`, `roleid`) VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 3);

 

 

 MY version of the model/UserRecord.cfc's "login" method: 

<cffunction name="login" access="public" hint="I log this user into the site" output="false" returntype="boolean">
 <!--- make this do some type of real authentication if desired--->
 <!--- you can find the plain-text passwords that match these users in the load() function --->
 <cfquery name="getUser" datasource="glock">
SELECT r.userid, r.firstname, r.lastname, GROUP_CONCAT( rr.rolename ) AS roles
FROM user r
INNER JOIN jctuserrole j ON j.userid = r.userid
INNER JOIN roles rr ON rr.roleid = j.roleid
WHERE r.username =  <cfqueryparam value="#getUserName()#" cfsqltype="cf_sql_varchar" />
AND r.password =  <cfqueryparam value="#getPassword()#" cfsqltype="cf_sql_varchar" />
GROUP BY r.userid, r.firstname, r.lastname
 </cfquery>
 <cfif getUser.recordcount eq 1>
  <cfset setFirstName(getUser.firstname) />
  <cfset setLastName(getUser.lastname) />
  <cfset setUniqueId(getUser.userid) />
  <cfset setRoles(getUser.roles) />
  <cfset setIsLoggedIn(true) />
 </cfif>
 <cfreturn getIsLoggedIn() />
</cffunction>

 (note: Notice my sweet usage of MySQL's awesome "GROUP_CONCAT" function! Turns that field's values into a list...EXACTLY what we need!)

Besides having the above, you also have to set all of the security type parameters in the Canvasconfig bean of Coldspring.xml appropriately to enforce security. They're self-explanatory.

That's it!

Beyond that, I did make a minor tweek to views/dsp.navigation.cfm and views/layout.main.cfm in order to display my user's name and to make the logout link more prominent.

dsp.navigation.cfm change:

just after line 20 ("<div id="navcontainer">"), added this short if statement:

 <cfif UserRecord.getIsLoggedIn()>
  Logged in as:<br><cfoutput>#UserRecord.getFirstName()# #UserRecord.getLastName()#<br>Roles: #UserRecord.getRoles()#</cfoutput>
 </cfif>

 layout.main.cfm
Just after line 31 ("<a href="#webpath#/index.cfm">#appTitle#</a>"), added this short if statement:
 

<cfif UserRecord.getIsLoggedIn()>
  <cfoutput>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   welcome #UserRecord.getFirstName()# #UserRecord.getLastName()#!
   <div style="width:90%;text-align:right;"><a href="#webpath#/index.cfm?event=logout" style="font-size:16px;font-style:italic;">Logout</a></div>
  </cfoutput>
 </cfif>

 

Posted by dougboude at 11:04 AM | PRINT THIS POST! | Link | 1 comment