servlets with snipsnap
[SnipSnap](snipsnap), the server that runs used to run this
site, is based on [Jetty](http://jetty.mortbay.com/), a standards based, pure
java servlet container and web application server. SnipSnap is implemented on
top of Jetty as a framework of servlets. Among other things, this means that you
can configure the Jetty inside SnipSnap to serve _your_ servlets, JSPs, or
anything else too! Here's how.
First, you'll need to configure Jetty to serve some part of your site outside of
SnipSnap. To do this, read my tutorial on
[virtual host redirection](virtual_host_redirection).
Done? Great. Now, all you need to do is decide which pages you want Jetty to
handle as JSPs, servlets, or whatever. You can specify everything in one
directory, e.g. /servlets/, or all files with a specific extension, e.g. \*.jsp.
In your jetty.conf, in the **** element, add a servlet
handler for those files:
JSP
*.jsp
org.apache.jasper.servlet.JspServlet
Add this handler _before_ the ResourceHandler that handles your static html
files. (The file mappings are matched against in the order that they appear.)
If you want to handle different files, or use a different servlet, replace the
parameters with whatever you want. For example, if you want to use dynamic
servlets, use **org.mortbay.jetty.servlet.Invoker** instead of
**org.apache.jasper.servlet.JspServlet**. If you're interested, the [Jetty
documentation](http://jetty.mortbay.com/jetty/tut/Server.html#nonwebapps) has
more information.