On Thu, 6 Feb 2003, Martin Cooper wrote:

> Date: Thu, 6 Feb 2003 17:19:47 -0800 (PST)
> From: Martin Cooper <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Buglet related to Globals.MAPPING_KEY?
>
> I just noticed something strange that I believe to be a minor bug, but I'm
> not sure which is intended to be the correct solution.
>
> RequestProcessor.processMapping() tries to find the ActionMapping for the
> current request. Once found, the mapping is stored in a request attribute,
> viz Globals.MAPPING_KEY. So far, so good.
>
> Now, further down the line, in RequestUtils.populate(), IFF the request is
> a multipart request, the mapping request attribute is removed from the
> request. This is the part that's odd.
>
> I believe the original reason for storing the mapping in a request
> attribute was so that it could be obtained in populate() when processing a
> multipart request, without having to pass it as a parameter all the way
> down. In fact, the only code that accesses the attribute is shortly above
> the only place that it's removed from the request.
>
> The catch is that it isn't removed for any other type of request. Now,
> obviously, we could fix this in one of two ways. We could either have
> populate() always remove it, or never remove it. Although the former is
> better matched with the original intent of the attribute, it's possible
> that people have assumed that it is always available, and written code
> with that in mind. In fact, the ConfigHelper class (not used, and marked
> as experimental) seems to make this assumption, even within the Struts
> code base.
>
> Therefore, to be on the safe side, I plan on removing the call to
> removeAttribute() from populate(), thus guaranteeing that the mapping is
> available regardless of the type of request being processed.
>
> Comments?
>

+1.

We've got a bunch of precedents in the module handling code for passing
request attributes under well-known names.  And, if we ever figure out how
to suport multiple mappings for the controller servlet gracefully, we're
going to want this as a request attribute in order to distinguish which of
the (potentially several) mappings matched on this request.

> --
> Martin Cooper

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to