Dave Johnson wrote:
Comments below...

On 5/24/06, Allen Gilliland <[EMAIL PROTECTED]> wrote:

guys, i could use a little help sorting out some ideas on how to
implement the url mapping code that will be used to provide the new url
structure.  i've got a couple of options i'm weighing and i'd like some
opinions.

8< snip

1. Expect users to override the HttpServletRequest object and pass that
to the rendering servlets.  So a user would write 2 pieces of code, 1) a
custom RequestMapper and 2) a custom HttpServletRequestWrapper.  In
their RequestMapper they would wrap the original request with their own
wrapper and pass that along when they dispatch the request.  The idea
being that in their custom HttpServletRequestWrapper they would override
the right methods to make their request look like a standard Roller
request.  This means overriding methods like getRequestURL(),
getPathInfo(), etc.


I don't understand this one, perhaps you could expand a bit. That said, I
sure don't like the sound of overriding HttpServletRequest. My initial
reaction is that it sounds messy and it sounds like it could require a lot
of guesswork and code-reading on the part of the implementor.

I think it's possible that I am going a little crazy and this may not even be necessary. I need to verify a couple things once I'm at my workstation tomorrow, but I think I had made an incorrect assumption when thinking about this one.

In any case, I agree. Expecting users to override the servlet request object is asking a bit much.




2. Modify our rendering servlets to expect a WeblogRequest object which
is basically just a parsed HttpServletRequest.  Our servlets would then
rely on this WeblogRequest object rather than directly on the
HttpServletRequest object when handling the request.  Users making
customizations would then be responsible for 1) defining their custom
RequestMapper and 2) properly constructing a WeblogRequest object.  So
in their RequestMapper they would inspect the request and create a
WeblogRequest object which would then be passed on to the rendering
servlets.


I like the sound of that one much better.


So the deal is that users who want to make custom extensions to the
Roller url scheme would have do something in their RequestMapper which
translates their custom url structure into the standard Roller url
structure.  That can happen by either overriding the HttpServletRequest
object that gets sent to the rendering servlets, or by overriding some
kind of custom parsed request object similar to RollerRequest.

My feeling so far is that option #1 is a little easier and lightweight
on us developers, but invites more room for error if someone doesn't
properly override all the correct servlet request methods.  Option #2 is
more controlled, but it requires more changes to our rendering
methodology and would probably require users to write more code.



In these two scenarios, what happens to the parsing code in RollerRequest?

I am hoping to migrate away from the RollerRequest object as I make tweaks to the rendering servlets. The RollerRequest object would still be around since it's used heavily in the authoring and admin struts code, but I'm hoping to isolate it there.

-- Allen



- Dave

Reply via email to