Railo 3.1, Tomcat and Aptana Cloud

66 views
Skip to first unread message

craig.kaminsky

unread,
Apr 1, 2009, 11:07:17 AM4/1/09
to Railo
Hi,

I've been working on deploying Railo (first 3.0 and, today, 3.1) to a
site I have on Aptana Cloud. The actual deployment was incredibly easy
(dumped the WAR file in the Tomcat ROOT and Railo was working).

However, I need/want to use SES-style URLs and because of how Aptana
Cloud is configured, Tomcat handles all HTTP requests, not Apache. So,
no .htaccess files are executed when a HTTP request arrives.

I've played with the UrlRewriteFilter but, while it works, I am
finding that I need to write too many rules for ColdBox and Mango Blog
(the two applications I've deployed to run on Railo). I feel like I
must be missing something.

Is there a relatively easy, straightforward was to get Tomcat to
recognize SES-style URLs?

Sorry if this is a bit off-topic (with the Tomcat stuff) but I would
love to get Railo off the ground on this Cloud.

Thanks!
Craig

Gert Franz

unread,
Apr 1, 2009, 11:17:21 AM4/1/09
to ra...@googlegroups.com
Craig,

Sean Corfield wrote something about this in his latest Railo related blog.
Check out here:

http://corfield.org/blog/index.cfm/do/blog.entry/entry/Railo_for_Dummies_Par
t_IV

Greetings from Switzerland
Gert Franz
Railo Technologies GmbH
gert....@railo.ch
www.railo.ch

Join our Mailing List
german: http://de.groups.yahoo.com/group/railo/
english: http://groups.google.com/group/railo
linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1
Bug tracker: http://jira.jboss.org/jira/browse/RAILO
Railo Blog: http://www.railo-technologies.com/blog


-----Ursprüngliche Nachricht-----
Von: ra...@googlegroups.com [mailto:ra...@googlegroups.com] Im Auftrag von
craig.kaminsky
Gesendet: Mittwoch, 1. April 2009 17:07
An: Railo
Betreff: [railo] Railo 3.1, Tomcat and Aptana Cloud

Barney Boisvert

unread,
Apr 1, 2009, 11:54:53 AM4/1/09
to ra...@googlegroups.com
I use UrlRewrite for pretty much all my apps, and it's great. The
total rule count should be about the same for mod_rewrite and for
UrlRewrite, since they're almost identical in functionality. The
biggest difference I've found is the lack of QSA (query string append)
on UrlRewrite, but that's usually not to much of a hassle.

If you REALLY need the functionality, I wrote a simple little hack to
allow you to fake it with request attributes. Assume you want this
functionality:

RewriteRule ^/([a-z]+).*$ /index.cfm?do=$1 [QSA,L]

That says take a URL like "/view?name=barney" and convert it to
"/index.cfm?do=view&name=barney". The first guess would be to write a
UrlRewrite rule like this:

<rule>
<from>^/([a-z]).*$</from>
<to last="true">/index.cfm?do=$1</to>
</rule>

but that'll trash your query string (yielding "/index.cfm?do=view"
without the name param). So instead, write a rule like this (where
the query string is untouched):

<rule>
<from>^/([a-z]).*$</from>
<set name="qsa.do">$1</set>
<to last="true">/index.cfm</to>
</rule>

That'll yield "/index.cfm?name=barney", plus a request attribute named
"qsa.do" with "view" in it. Then at the top of your app
(Application.cfc or whatever) run this code:

<cfset req = getPageContext().getRequest() />
<cfset enum = req.getAttributeNames() />
<cfloop condition="enum.hasMoreElements()">
<cfset i = enum.nextElement() />
<cfif isSimpleValue(i) AND left(i, 4) EQ "qsa.">
<cfset url[removeChars(i, 1, 4)] = req.getAttribute(i) />
</cfif>
</cfloop>

That simply loops over the request attribute and creates URL variables
for any that start with "qsa.", which is what was set in the second
rule. You won't have the right query string in the CGI scope (it'll
just be "name=barney"), but your URL scope will have everything you
want.

cheers,
barneyb
--
Barney Boisvert
bboi...@gmail.com
http://www.barneyb.com/

Dave

unread,
Apr 2, 2009, 5:02:37 AM4/2/09
to ra...@googlegroups.com

craig.kaminsky

unread,
Apr 2, 2009, 9:48:52 AM4/2/09
to Railo
Thank you, all, VERY much! I'm knew to the Java server world and this
is extremely helpful.

@Gert: I had checked out Sean's post and what he was working, I was
able to do on my development box. The Cloud service, however, doesn't
allow root access (without turning off benefits to other features), so
I could not get to any Apache configuration files to tweak the VHosts,
etc. Great job with Railo, by the way...and congrats on 3.1!

@Barney: I really appreciate your detailed explanation of the
UrlRewriteFilter. I was having trouble getting my head around it and
thanks to your example, I can see where the set element can help out a
great deal.

@Dave: That's a very nice, little tool. Thanks!

Best,
Craig
> > On Wed, Apr 1, 2009 at 8:07 AM, craig.kaminsky <craig.kamin...@gmail.com
> > > wrote:
>
> >> Hi,
>
> >> I've been working on deploying Railo (first 3.0 and, today, 3.1) to a
> >> site I have on Aptana Cloud. The actual deployment was incredibly  
> >> easy
> >> (dumped the WAR file in the Tomcat ROOT and Railo was working).
>
> >> However, I need/want to use SES-style URLs and because of how Aptana
> >> Cloud is configured, Tomcat handles all HTTP requests, not Apache.  
> >> So,
> >> no .htaccess files are executed when a HTTP request  arrives.
>
> >> I've played with the UrlRewriteFilter but, while it works, I am
> >> finding that I need to write too many rules for ColdBox and Mango  
> >> Blog
> >> (the two applications I've deployed to run on Railo). I feel like I
> >> must be missing something.
>
> >> Is there a relatively easy, straightforward was to get Tomcat to
> >> recognize SES-style URLs?
>
> >> Sorry if this is a bit off-topic (with the Tomcat stuff) but I would
> >> love to get Railo off the ground on this Cloud.
>
> >> Thanks!
> >> Craig
>
> > --
> > Barney Boisvert
> > bboisv...@gmail.com
> >http://www.barneyb.com/
Reply all
Reply to author
Forward
0 new messages