I have just migrated this blog from Coldfusion to Railo today and thought I would share the process for anyone else who needs to get MangoBlog workign with railo.
Initially I thought it had all worked without a hitch, but then I found a couple of things broke. None of the links worked anymore as Railo (or rather Tomcat) does not support search engine friendly urls out of the box.
In order to get the SEO urls to work you need to make some changes to the c:\railo\tomcat\conf\web.xml and insert the following in the servlet mappings section.
<servlet-mapping> <servlet-name>GlobalCFMLServlet</servlet-name> <url-pattern>/page.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>GlobalCFMLServlet</servlet-name> <url-pattern>/post.cfm/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>GlobalCFMLServlet</servlet-name> <url-pattern>/archives.cfm/*</url-pattern> </servlet-mapping>
Then restart tomcat and all should be good. If you have any app that has something.cfm/other stuff then you will need to do the above with any other filenames as well.
I did try using the following
<servlet-mapping> <servlet-name>GlobalCFMLServlet</servlet-name> <url-pattern>/*.cfm/*</url-pattern> </servlet-mapping>
but sadly it doesn't work.
This is one of things that sucks with Railo, there is a lot of tweaking and manual config to get it to do all the things that ColdFusion just does out of the box.
One other thing that I found during this migration is that the caller scope does not work properly in Railo, if you are trying to use caller scope to set variables in other scopes it simply does not work.
For example, say you have the following code in a custom tag called mytag.cfm
<cfset Caller[Attributes.returnVar] = foo>
and you called the tag as follows
<cf_mytag returnvar="request.foo">
or
<cf_mytag returnvar="local.foo">
or
<cf_mytag returnvar="someStruct.foo">
it simply doesn't create the variable, this however works fine with Coldfusion.
In or order to fix this I had to use a simple variable
<cf_mytag returnvar="foo">
This was the only format that worked,
Nov 30, 2011 at 1:30 AM I have mangoBlog running on Railo as well.
Here is my Tomcat mapping for the mangoBlog files
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/post.cfm/*</url-pattern>
<url-pattern>/archives.cfm/*</url-pattern>
<url-pattern>/page.cfm/*</url-pattern>
<url-pattern>/author.cfm/*</url-pattern>
<url-pattern>/feeds.cfm/*</url-pattern>
</servlet-mapping>
Needed for pages like
http://www.michaels.me.uk/author.cfm/russ
Nov 30, 2011 at 7:52 AM I don't consider your caller scope issue a *real* bug, even if it's not the same behavior as in ColdFusion. All vars are correctly created in variables scope!
And Railo does it exactly the way it is defined: "The custom tag's Caller scope is a reference to the calling page's Variables scope. Any variables that you create or change in the custom tag page using the Caller scope are visible in the calling page's Variables scope."
So after execution of the page you can find the vars variables.request.foo, variables.local.foo, variables.someStruct.foo and variables foo.
Quite a lot of discussion about what's the expected behavior and how it is implemented in ColdFusion can be found on Ben Nadel's blog and even on StackOverflow.
Nov 30, 2011 at 8:35 AM After some further tests I found out that Railo (3.3.1.005) creates the vars like variables["someStruct.foo"]. Note the period within the key. That really doesn't seem right, even to me. ColdFusion correctly creates the implicit structs in the same test.
So yes, I agree, this seems to be a bug in Railo.
Dec 5, 2011 at 2:49 PM It is a real shame there are so many manual tweaks required though, as this really makes Railo unsuitable for shared hosting, as you would forever be having to do things like this to get customers sites to work. It only when you use Railo or OpenBD that you truly realise what a great job Adobe actually did with ColdFusion to make everything just work out of the box.
Dec 31, 2011 at 10:26 PM I've tried this out and there is still a hiccup. Without the entries above (in web-inf/web.xml under site root) I get the 404 error by tomcat saying (blah.cfm) not found. If I make the changes above I still get a 404 but with () not found, i.e. the path not found is empty. This is IIS7.5 2008r2 Tomcat Railo install. Basically a "stock" install using Railo's presets. Any ideas?
Dec 31, 2011 at 10:37 PM Well I decided to quit being such a chicken and made the changes to the railo\tomcat\conf\web.xml file instead of the web.xml file under the site root. It worked but it scares the crap out of me to do stuff like that, especially since Railo seems more finicky than the worst British car. Some quick testing makes it appear the other sites on the box are still working fine. Any ideas on why this didn't work "per site"? That'd be a lot better than box-wide. Just as a note I originally did the changes per the AJ Mercer comment above which matched other things I found on the web for "per site" mods. Thanks! Irv
Jan 13, 2012 at 12:05 PM Irv, I only tested this on my Jetty install, I don;t know if it works the same on tomcat, you may want to search the Railo wiki and google group and see if someone else has mentioned it. It may just be that you need a different filename or location for Tomcat.
Aug 16, 2012 at 7:24 PM sorry to anyone who has commented in last few months, there was a bug on my blog since I moved it to Railo and it was not sending out emails to anyone, including to me to tell me there were comments to moderate and so I haven't logged in for months. So I only just processed months works of comments.
Nov 8, 2012 at 6:24 PM Is there a reason why this cannot be done with URL rewriting alone? Am unable to edit web.xml as I'm on shared hosting
Nov 8, 2012 at 9:14 PM yes because Railo by default doesn't know how to process the url.
Just ask your host to make the changes, they really shouldn't have any issue with it.