Christopher Schultz wrote:
Quick question: multipart/form-data is typically used for file upload...
why not use application/x-www-form-urlencoded instead? I realize the
problem is that certain browsers do not send the proper charset in the
Content-Type, but I'd like to understand your affinity for
multipart/form-data.
This :
http://www.w3.org/TR/html401/interact/forms.html#h-17.13
See the note in green at the end of 17.13.1 Form submission method.
Plus, the fact that our applications (area : document management) very
often do offer the possibility to upload a file from within forms.
Plus, the fact that the same applications often do offer the possibility
to submit very large non-USASCII text fields.
Plus, the fact that most of my activity relates to users who are not
mainly English-speaking and do not use a US keyboard to fill-in web forms.
Plus, the fact that having seen HTTP/HTML being born, I remember the
time when URL's were typically limited in size, in a manner inconsistent
between platforms. That might still be the case.
Somewhat abusively I admit, I took an early aversion to
application/x-www-form-urlencoded, as synonymous to GET, to non-capable
of anything but US-ASCII (ok, iso-8859-1 at a stretch, but see the above
green note) and to "nobody agrees as to the proper percent encoding and
at what moment it should take place or not".
The multipart/form-data encoding does not have all of these
connotations, and should be a foolproof way for a browser to send data
to a server without any size limit or charset ambiguity.
It is therefore a big surprise and big disappointment to see that
browser developers do not take advantage of this, for some reason I have
trouble to fathom (because it's there, it is well-defined, it is easy to
do, and it would save a lot of problems).
It is also a big disappointment to see (you are right, I checked) that
the Servlet Spec does not foresee a simple method to get the parameter
values if they are posted via the multipart/form-data encoding method.
That is probably because for 10 years or so, I have been using this
under Apache and perl without any problems at all : I just use the
equivalent of GetParameter() there, without having to worry a jot about
the request encoding; and why should I have to ?
Read the body myself and parsing it ? in 2009 ?
Now come on, I am sure that there must exist some standard Java library
usable in a servlet context, and which does that, no ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org