tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Cannot read httpservlet's inputstream
Date Tue, 07 Apr 2009 19:55:09 GMT
Andrey Razumovsky wrote:
> Well, I've been looking through those 15 lines last two days.. I tried
> Apache's HttpClient with same effect (I used FileEntity for body, not
> multipart). I've seen many examples in Google which send post request.. My
> code is just the same..
Hi.
I did some research, because I wanted to wrap up a number of recent 
discussions on this forum.

Despite what you may wish and what you may have found in Google, I 
believe that if you want to send a file, you have to do it with a 
"multipart/form-data" content type.  That is because it is the only way 
to let the server know what kind of file your are sending, and how it is 
encoded.  The Apache HttpClient library will let you do that. I do that 
in a couple of application, and I never had a problem with Tomcat 4 and 
5.  Have not tried it yet with Tomcat 6, but this is so basic that I 
doubt there would be a problem.
Have a look here :

http://www.faqs.org/rfcs/rfc2616.html
Sections 9.5 (POST) and 9.6 (PUT) describe the two methods that allow 
you to upload a file.  But 9.6 is not applicable, since you are sending 
this to a webapp, not directly to a URI.
There are also
http://www.faqs.org/rfcs/rfc2388.html
http://www.faqs.org/rfcs/rfc2046.html
http://www.faqs.org/rfcs/rfc2046.html
Then there is http://www.w3.org/TR/html401/interact/forms.html
which is the only document that I have found which describes a bit more 
in detail how you should POST a file via HTTP.
Look at section
17.13.4 Form content types

Now, the funny part is that I don't find a corresponding 
request-handling method on the server side for such a POST..
Not in the servlet specs, that is.
?
It seems that I need some more Googling myself.

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


Mime
View raw message