On Wed, Mar 20, 2002 at 12:20:42PM -0500, Love, Jay wrote:
> As I sat down to write a response to this proposal of per servlet
> extraURLPath, saying this will be really hard to do, I decided to think
> before I responded (a rare thing). And actually, this might not be too
> terribly difficult.
> The way extraURLPathInfo works is that when we get the request, we have to
> find the servlet that matches it. So we start with the whole request URL,
> and see if it matches an actual file on the system. If it doesn't, and
> extraURLPathInfo is turned off, then we return a 404. If extraURLPathInfo
> is turned on, then we pull off the last directory in the URL and see if the
> remaining portion matches a path on the system, and so on until we either
> find a servlet or reach the root of the context. If we find a servlet that
> matches a portion of the URL, then we use that servlet and pull off the rest
> of the URL and call it extraPathInfo.
That sounds like what I expected, although I didn't think about
backtracking multiple levels.
We could avoid backtracking more than one level, although it would cause
extra path info's that happen to match subdirectory names to fail, which
is probably minor but unacceptable.
Why do you have to backtrack multiple levels? As you go down the URL
levels, you will either match a directory, a file or nothing.
Already handled, use the directory's index servlet.
Drill down until you find a regular file. If it's a servlet,
import it and check .wantExtraPathInfo. If true, proceed.
If false, -?- ignore the path info? If it's not a servlet, try
to serve it as a non-servlet file.
Drill down until you get a "not found" error. Take the
directory's index servlet if it exists. Import it and check
.wantExtraPathInfo. If true, proceed. If false, raise
What if we find a real servlet but .wantExtraPathInfo is false but the
URL has extra path info? Ignore it?
> You'd, preferably, be able to set a site
> wide property of extraURLPathInfo on or off, which the initial value of all
> servlets would be set to, and then change that on a per servlet basis.
This can be done with a method in HTTPServlet.py, so there is always a
default. Sites that want to override it site-wide can put it in their
topmost site superclass. Either way we could get rid of the
> The actual implementation of this won't be as clean as I've described it
> here, for various reasons, mainly because when we're searching for a path,
> we don't have access to a servlet. So we'd have to return from the search
> function, get a servlet, see if there is extraURLInfo, see if the servlet
> permits that, and proceed acordingly. But it can be done.
A little more work, but because we're still importing a maximum of one servlet
per request, it doesn't seem like a serious performance hit. Just the
overhead of a few more directory searches.
-Mike (Iron) Orr, iron@... (if mail problems: mso@...)
http://iron.cx/ English * Esperanto * Russkiy * Deutsch * Espan~ol