UNC-Charlotte's College of Information Technology
UNC-Charlotte's College of Information Technology has deployed Jetty in such a manner to allow the serving of servlets, JSPs, and WebMacro documents from each student's AFS home directory, allowing for a centralized, full-featured place for students to experiment with Java on the server side without having to
deal with either the initial server configuration or fighting with uploading
files to a server's local disk.
Having an open-sourced pure-java implementation of both the core webserver
and the servlet container in a single implementation / code tree has proven
invaluable. Jetty 3's HandlerContext paradigm has allowed us to support
serving servlets / JSPs for potentially thousands of students efficiently
by:
1) A low-priority Handler (reg'd at "/") that detects if a URI
along the lines of "/~username/*" has been hit. If so, it strips out the
username component, and if the user actually exists and has not been set up in
this fashon already, if builds a new HandlerContext to deal with requests for
this user's static resources, dynamically loaded servlets, and JSPs. It pushes
the new HandlerContext onto the stack as handling the "/~username/*", so that
this new "personal" handler will be queried for that person's stuff before
the low-priority one will.
2) The low-priority handler retains references to all of the
personalized handler contexts it creates, so that they can be destroyed and
restarted upon demand via interacting with an admin-esque servlet. Students
request the servlet to discard and recreate their personal handler so as to
implement class-reloading after compilation.
Even though any of the thousands of students enrolled in courses
hosted by the College of Information Technology could write / test their
own servlets, each day only a relatively small subset does. Having the
contexts built "on demand" in this fashon allows for efficient and speedy
serving for the folks who use it, while at the same time requiring no
studnet -> administrator interaction for a new user to use it. Periodic
restarting of the servlet server (cron job in the middle of the night)
serves to be an effective garbage collector of inactive user contexts.
Check out servlets.uncc.edu/ for more details.
Return to JettySuccessStories