Viewing By Entry / Main
May 8, 2009
Railo includes it's own FileServlet for serving up non-CFML files. If you are running Railo on Tomcat, it is easy to tell Railo to use Tomcat's Servlet instead of its own.

Edit the Railo web.xml file in WEB-INF/ and find this XML:

<servlet-mapping>
      <servlet-name>FileServlet</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>
Change it to this:
<servlet-mapping>
      <servlet-name>default</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>
Restart Tomcat. Now all your non-CFML files are served directly via Tomcat.

While developing and testing, it's often useful to have directory listings enabled so you can browse directories (particularly if you have directories full of example / test code). There's no way to enable that with Railo's FileServlet but you can do it for the default Tomcat Servlet by changing the listings setting in the global web.xml file (in Tomcat's conf/ directory):

<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>

Comments

Thanks, Sean.


Its these little nuggets that make me sing.

Thanks especially for the dir listing tip.

I'm really loving Railo. It is mind blowing fast.


one good thing about this is that this FileServlet also take care on mappings defined in railo administrator. you can call files in browser via mapping name: http://localhost/myrailomapping/test.gif.

one bad thing (and the reasion that this servlet is not enabled by default) this servlet is not realy powerfull, it has no caching mechanisms,like most fileservlet impl have.


Hey Sean, would the servlet-mapping you've implemented here be justification to drop Apache as my web-server and go with Tomcat exclusively? Right now I am running Apache for serving static content and for URL rewriting. Can Tomcat (on Jboss) handle all of the rewriting? Would this be a reasonable move to drop Apache?


Tomcat is certainly a very capable, production quality web server. I personally like the way Apache works so I'd probably keep it in front of Tomcat and let it handle static assets and .htaccess and rewrites etc. I think it's really personal preference tho'...


Well, I prefer Apache, I just thought maybe there was a benefit to doing it with this tip. :) Thanks!


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by