-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 6/20/2009 7:59 AM, André Warnier wrote:
> Or as "multipart/form-data"...
> Now this raises an additional nitpicking question :
> It has been mentioned before, that Tomcat provides no standard mechanism
> to read POST parameters that have been sent that way.
> But, the servlet spec 3.0, at the end of section 3.1, says :
> 
> "Data from the query string and the post body are aggregated into the
> request parameter set. Query string data is presented before post body
> data. For example, if a request is made with a query string of a=hello
> and a post body of a=goodbye&a= world, the resulting parameter set would
> be ordered a=(hello, goodbye, world)."
> 
> Now, considering that, for a html <form>, it is entirely valid to send
> form parameters using the "multipart/form-data" encoding, and
> considering the above paragraph, where does that leave us ?

The spec still only mentions application/x-www-form-urlencoded, so
multipart/form-data parsing is up to the application (or, more
practically, a library used by the application).

> It should mean that the getParameterMap() method, for instance, has at
> least to "peek" at the body, determine if it /could/ contain parameters,
> and if yes parse it to extract them.

True.

> If it does, then Tomcat /does/ contain code that can parse a
> multipart/form-data body.

No. Part of the "peek" process is to check the content-type. A
content-type of multipart/form-data is ignored.

> If it doesn't, then Tomcat does not respect the servlet spec.

No, it's adhering to the spec. You're confusing POST data (in general)
with POST data identified as parsable by the servlet spec in section
3.1.1 (of 2.5... not sure about 3.0). Tomcat will simply ignore
multipart/form-data requests when it comes to parameter parsing.

Other libraries can be rigged to provide parameter data from both
sources (GET and multipart POST).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAko/3ZsACgkQ9CaO5/Lv0PDyiACgknhVNvhfRj2aUvPLct31BlW6
r4kAn0QKoKlmm4ouQ13Fy9Sq1yhdz7Am
=VIgv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to