SnipSnap, the server that runs used to run this
site, is based on Jetty, 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.
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
<Call name="addHandler">
<Arg>
<New class="org.mortbay.jetty.servlet.ServletHandler">
<Call name="addServlet">
<Arg>JSP</Arg>
<Arg>*.jsp</Arg>
<Arg>
org.apache.jasper.servlet.JspServlet
</Arg>
</Call>
</New></Arg>
</Call>
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 has more information.