From: Love, J. <Jay...@us...> - 2001-03-12 20:09:54
|
I think this code is a step in the right direction. In needs a lot of cleanup, but it seems to add a nice level of abstraction to the mapping process. As far as implementing this as a pluggable architecture, I have a design that I have been meaning to implement where this would fit very well. The basic idea is to create a Context object. The Context object would be added as a member of Transaction when a request is processed. The default Context object would simply provide some threadsafe methods for varibale storage and retrieval. We could add a URLDecoder as a default member of the default Context object. To add this decoding object to the mix, we might try this: A context registers itself with the application in the normal way. In the context's package intialization code, we give it the chance to register a custom Context object that it would like to be used. That custom Context object can do anything the developer wants, including using a custom url decoder. If the context does not register a custom Context object, the stock Context object and URLDecoder implementation is used. When a request comes in, Application determines which context the request should go to, just as it does now. However, Application's processing stops there, it does not determine the url mapping itself. Instead, once it determines the context, it calls that context's Context instance to decode the URL and return a server side path. Then, processing continues normally. The main drawback I see is that this only allows for one level of mapping, ie the context determination only happens at the top level directory. But I don't think that's a particularly large problem. The attractiveness of the Context object is that it could also do some basic processing before a Servlet is actually called. So it could do an authentication check, etc, so that code wouldn't need to be placed in every Servlet. Any comments? Jay ---------------------------------------------------------------------------- This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation. ---------------------------------------------------------------------------- |