cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: The contract of Request.get() ?
Date Mon, 12 Jul 2004 08:24:20 GMT
Carsten Ziegeler wrote:

>It seems to me that the contract of the get() method on the 
>Request object is not defined very well.
>  
>

To say the least ;-)

>The javadoc says:
>    /**
>     * Returns the value of the named attribute as an <code>Object</code>,
>     * or <code>null</code> if no attribute of the given name exists.
>     */
>So, from this I would conclude that it's the same as getAttribute(name),
>so it's superfluous.
>In fact, the CLI Request object does implement it in this way.
>
>But :) the http request implementation, does the following:
>
>    if (req instanceof MultipartHttpServletRequest) {
>        return ((MultipartHttpServletRequest) req).get(name);
>    } else {
>        // This is a shortened version of the exact code:
>        return req.getParameterValues(name);
>    }
>
>So, this implementation is not about attributes at all! Looking through
>our code, it seems get() is used whenever it comes to handle an uploaded
>file.
>  
>

We can consider that the contract of get() is to return request 
*parameters* (and not attributes) in an object form when special 
processing has been made on these parameters. And the only parameters 
that currently have a special processing are file uploads.

>I think we should correct the javadocs and the implementation for the CLI.
>  
>

+1. As uploads have no meaning for CLI, this should be same as 
request.getParameter()

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message