Snipsnap,
the server that runs 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 element, add a servlet
handler for those files:
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.
servlets with snipsnap
Snipsnap, the server that runs 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 element, add a servlet
handler for those files:
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.
See also: