Absolutely. Which is exactly what I *have* done in the past when creating stricter REST web services. But for this simple example I decided not to go into that much detail -- which, on reflection, was obviously a mistake, considering your comments and others. ;-)
In any case, the main problem with providing for a proper URI (for example, something like /test5.py/XXXXX) as my example stands, is that I don't think the servlet mapping will pick up test5.py as the correct servlet to call. You probably end up with a Not Found error (I'm on holiday at the moment, so it's a bit hard to check). To create a stricter version, I believe subclassing PyServlet will be required in order to provide for the slightly more complicated uri structure. Unless someone else has a better idea of course.