On Thu, 2001-11-15 at 17:21, Sascha Matzke wrote:
> My suggestion is that we move the file system stuff were
> it (IMO) belongs - into the ServletFactories that handle
> physical files.

There does seem to be a concensus that URL mapping needs to be
generalized, to enable exactly the things you are thinking of (and other
stuff -- there's a list of ideas on the Wiki).  None of this is
implemented, though.

What you want to do is possible with the current system, though with
some loss of performance (slightly in the URL mapping algorithm, more
significantly because you don't get the caching you get with normal
servlets -- though you can do your own caching).  If you set
extraURLPath=1 in Application.config, then you can call
request.extraURLPath() and get a trailing portion to the URL.

In what might be a feature, but to me feels like a bug, if you have
something like:

MyContext/index.py

And someone asks for:

MyContext/path/to/whatever

Then index.py will be called with extraURLPath = '/path/to/whatever',
meaning you have a fully virtual URL and you'll never get a 404. Not
pretty, though.  mod_rewrite can do stuff for you too.


As far as the fix, you can't really do this entirely in the
ServletFactory, because you don't know which kind of ServletFactory to
call until you've parsed the URL to find what name matches to what
resource (which may or may not be a file).  Extensions in the URL, for
all their ugliness, do make the framework's job easier :)

Personally, I think there should be URLMappingFactories, and the whole
process should be much more recursive than it currently is (thus
allowing arbitrary hooks at different points in the URL space).  Much
more computationally complex, but still not that bad relatively, and it
could be quite efficiently cached.

OTOH, if ServletFactories were recursive, calling each other, maybe that
would be equivalent to a URLMappingFactory.  I.e., everything would
initially normally go to the FileSystemServletFactory, which might
notice a special file (say "items.map"), so that anything that started
with items/ would be handled by a factory as defined in items.map -- or
it might detect which ServletFactory according to a file with an
extension -- or it might recursively call another factory if a directory
matched the initial part of the URL.

Just whatever we do, we must not reproduce Aquisition :)

  Ian



_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to