Hello friends! I've seen a couple of posts here about setting up SES URLs with Jetty and I just had a hell of a time getting it to work but I did. I'd just like to post what I did here to A. Help others, B. Make sure I'm not a dummy and did it right.
First of all I'm using the Ready2Run Jetty+OpenBD package so you know where I'm starting. 1. In this package the <a href="http://docs.codehaus.org/display/JETTY/ RewriteHandler">jetty-rewrite-handler</a> isn't installed by default so thats one of the first things you need to do. To install the handler this page suggests using maven to install it, but I don't have maven installed so I did it by hand. I went to <a href="http:// mirrors.ibiblio.org/pub/mirrors/maven2/org/mortbay/jetty/jetty-rewrite- handler/6.1.12rc1/">this maven repository</a> and downloaded jetty- rewrite-handler-6.1.12rc1.jar to my /jettyhome/lib/ext directory. (I found out where to put it by reading the POM file) (If you download by hand make sure your version of jetty matches the correct version of the rewrite handler) 2. Download the example rewrite handler XML config file from mortbay. <a href="http://svn.codehaus.org/jetty-contrib/branches/jetty-6.1.x/ contrib/jetty-rewrite-handler/src/main/config/jetty-rewrite.xml">jetty- rewrite.xml</a>. This goes in your /jettyhome/etc directory. 3. Create a rewrite rule in the jetty-rewrite.xml file. Here is an example I'll use later. This will make http://yoursite.com/data/8675309 readable at http://yoursite.com/data.cfm?dataID=8675309 by BlueDragon. <Item> <New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule"> <Set name="regex">/data/([0-9]*)</Set> <Set name="replacement">/data.cfm?dataID=$1</Set> </New> </Item> 4. Add the following lines of code to your webdefault.xml file. (Also in your /jettyhome/etc dir) I'm only hosting one app on this server but if you have more you can put the following code in your /jettyhome/ webapps/appname/WEB-INF/web.xml file. As far as I can tell this tells jetty to get ready for SES URLs. Without this piece of code when Jetty tries to send http://yoursite.com/data/8675309 to http://yoursite.com/data.cfm?dataID=8675309 you get a 404 Page Not Found error from Jetty. (On another note, it would be super useful if this was included in the webdefault.xml file included with the Ready2Run Jetty OpenBD file. I wasn't aware of this setting until I downloaded the WAR file and went through that) <filter> <filter-name>SearchEngineFriendlyURLFilter</filter-name> <display-name>SearchEngineFriendlyURLFilter</display-name> <description>SearchEngineFriendlyURLFilter</description> <filter- class>com.newatlanta.filters.SearchEngineFriendlyURLFilter</filter- class> <init-param> <param-name>extensions</param-name> <param-value>cfm,cfml</param-value> </init-param> </filter> <filter-mapping> <filter-name>SearchEngineFriendlyURLFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 5. Alright so now if I go to http://yoursite.com/data/8675309 it goes to the data.cfm file but its not reading the dataID param. (using both <cparam name="dataID" default="0"> and <cfdump var="#url.dataID#">. I'm not sure why, I'll look at it more later but I need to get back to work on other parts of code! Here is a piece of code I put at the top of the data.cfm file to read dataID: <cfscript> varInfo = cgi.PATH_INFO; idStart = find("=",varInfo); dataID = right(varInfo,len(varInfo)-idStart); </cfscript> Keep in mind that if you have multiple variables this little piece of code will change a lot. This is for a very simple site hence some very simple code. I'm just grabbing the dataID there so I can pass it into my service CFCs to handle the real data. Alright, so my memory is fuzzy after too many hours dealing with this guy here but I believe thats all the setting up one has to do. From now one when you startup Jetty you need to also pass the jetty- rewrite.xml to java. Here's some simple startup code: java -jar start.jar etc/jetty.xml etc/jetty-rewrite.xml So thats that, its working for me now. It feels a little fragile but I'll work with it some more. How do you feel about this? Am I way offbase? If not, I hope this is helpful and saves someone some time! On another note, I just started using OpenBD after using Adobe exclusively for years and I am very pleased. It rules! With this up in the "cloud" its super cool and being a small startup I'm very happy it doesn't cost me an arm and a leg. Jimmy --~--~---------~--~----~------------~-------~--~----~ Open BlueDragon Public Mailing List http://groups.google.com/group/openbd?hl=en official site @ http://www.openbluedragon.org/ !! save a network - trim replies before posting !! -~----------~----~----~----~------~----~------~--~---
