Chris, I see the content when I read the InputStream. Thanks for your help.
Kumar --- On Fri, 3/26/10, Christopher Schultz <ch...@christopherschultz.net> wrote: > From: Christopher Schultz <ch...@christopherschultz.net> > Subject: Re: tomcat PUT not working > To: "Tomcat Users List" <users@tomcat.apache.org> > Date: Friday, March 26, 2010, 10:33 AM > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Kumar, > > On 3/25/2010 4:34 PM, Kumar Kadiyala wrote: > > I have REST based web services some of which use the > PUT method. The > > PUT method can contain a request body. The web service > works fine > > with Websphere and is out in the field. > > > > We are in the process of migrating to tomcat and I > noticed that my > > web service which uses PUT is not able to get the > request body > > anymore. I use HttpServletRequest's getInputStream and > it always > > returns null. > > No exception, but you get NULL instead? Strange. > > > What is the Content-Type of the request? > > KK >> The Content-Type is text/xml. > > If the Content-Type is text/xml, you should probably be > using > HttpServletRequest.getReader, but maybe not if you want the > raw bytes to > provide to an XML parser. > > > Changing the method to POST will affect customers in > the field and > > also breaks RESTful principles. > > I am not suggesting that you switch to POST. > > > Yes, It does seem like the request body is empty. > > Empty request body != null. Which is it? Can you verify > with a packet > sniffer that the request body is actually non-null? What's > the > Content-Length? > > > I misspoke earlier. The InputStream is not null but > the method > > available() on the InputStream is returning 0. If I > change the method > > to POST, InputStream's avialable() is returning a > value > 0. > > InputStream.available returns the number of bytes readable > without > blocking, not how many bytes can eventually be read by the > caller. > > Try actually reading from the InputStream and see what > happens. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkus4e0ACgkQ9CaO5/Lv0PDDAACffWKdhyFzbDmY3KNi4+8s+Wjy > WGIAoIuW5Lo6MK0qEkqHeYVOUhM7oWNo > =TpUQ > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org