Hot to access raw POST Data in servlet?

2007-07-17 Thread Joe Kramer

Hello,

I can't find a way to do a simple thing - access raw postdata in
servlet service()/doPost() method. (The data that goes after the
headers.)
In old Servlet API it was possible using
javax.servlet.http.HttpUtils.parsePostData() which is now deprecated.
Servlet API only seem to have methods to access request parameters and
properties in HttpServletRequest, but not the request data itself.

What is the best/pssible practice to do that?

Thanks.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hot to access raw POST Data in servlet?

2007-07-17 Thread Johnny Kewl


- Original Message - 
From: Joe Kramer [EMAIL PROTECTED]

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, July 17, 2007 2:51 PM
Subject: Hot to access raw POST Data in servlet?



Hello,

I can't find a way to do a simple thing - access raw postdata in
servlet service()/doPost() method. (The data that goes after the
headers.)
In old Servlet API it was possible using
javax.servlet.http.HttpUtils.parsePostData() which is now deprecated.
Servlet API only seem to have methods to access request parameters and
properties in HttpServletRequest, but not the request data itself.

What is the best/pssible practice to do that?


Joe, I'm far too young to remember this function, so just slap me around if
I dont get it ;)
If all that function gave you was a HashTable of parameters then wont
getParameterNames be good enough?
Ie you can enumerate through them find the parameters and the values... like
this

   Enumeration paramNames = request.getParameterNames();
   while(paramNames.hasMoreElements()){
   paramName = (String)paramNames.nextElement();
   paramValue = request.getParameter(paramName);
   }

or you could use getParameterMap if you looking for something close to
the old HashTable.
getInputStream... will give you the raw stream.

Young guys like me, use the Enumeration... its handy when you have more than 
one submit button ;)





Thanks.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hot to access raw POST Data in servlet?

2007-07-17 Thread Frank W. Zammetti
Have a look here:

http://javawebparts.sourceforge.net

...more specifically this:

http://javawebparts.sourceforge.net/javadocs/javawebparts/request/RequestHelpers.html

...the getBodyContent() is, I think, what your looking for.

hth,
Frank

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of Practical Ajax Projects With Java Technology
 (2006, Apress, ISBN 1-59059-695-1)
and JavaScript, DOM Scripting and Ajax Projects
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

On Tue, July 17, 2007 2:55 pm, Johnny Kewl wrote:

 - Original Message -
 From: Joe Kramer [EMAIL PROTECTED]
 To: Tomcat Users List users@tomcat.apache.org
 Sent: Tuesday, July 17, 2007 2:51 PM
 Subject: Hot to access raw POST Data in servlet?


 Hello,

 I can't find a way to do a simple thing - access raw postdata in
 servlet service()/doPost() method. (The data that goes after the
 headers.)
 In old Servlet API it was possible using
 javax.servlet.http.HttpUtils.parsePostData() which is now deprecated.
 Servlet API only seem to have methods to access request parameters and
 properties in HttpServletRequest, but not the request data itself.

 What is the best/pssible practice to do that?

 Joe, I'm far too young to remember this function, so just slap me around
 if
 I dont get it ;)
 If all that function gave you was a HashTable of parameters then wont
 getParameterNames be good enough?
 Ie you can enumerate through them find the parameters and the values...
 like
 this

 Enumeration paramNames = request.getParameterNames();
 while(paramNames.hasMoreElements()){
 paramName = (String)paramNames.nextElement();
 paramValue = request.getParameter(paramName);
 }

 or you could use getParameterMap if you looking for something close to
 the old HashTable.
 getInputStream... will give you the raw stream.

 Young guys like me, use the Enumeration... its handy when you have more
 than
 one submit button ;)



 Thanks.

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]