Note: these comments apply to Webware 0.8.  I haven't looked at CVS recently.
 
request.rawInput() only works if the request has an "irregular" content-type such as text/xml which is what you get with XML-RPC, or text/x-python-pickled-dict which is Pickle-RPC.  If the content-type is one of the standard types multipart/form-data or application/x-www-form-urlencoded, then the raw input is processed into fields and discarded when the HTTPRequest object is initialized, presumably for memory reasons.  This is all done in the Python standard library cgi module, so it would be a bit of work for us to pry that apart and handle it in a different way.
 
I have a suspicion that what you want to do is to reconstruct the raw input in order to re-POST it to another HTTP server.  If so, then for application/x-www-form-urlencoded data something like
 
    urllib.urlencode(self.request().fields(), doseq=1)
 
should work fine.
 
- Geoff
 
-----Original Message-----
From: Aaron Held [mailto:aaron@MetroNY.com]
Sent: Monday, April 28, 2003 3:37 PM
To: cprinos@foliage.com
Cc: jose@cybergalvez.com; webware-discuss@lists.sourceforge.net
Subject: Re: [Webware-discuss] rawInput does not work?

One of the problems seems to be that Webware just sucks up all of the raw input.  Is there a way to recoved this?

I want to pull out the POST data directly, is there a good way?
The POST data is already in FieldStorage, but I want it just the way the browser sent it.

Thanks,
-Aaron

Chris Prinos wrote:
-----Original Message-----
From: webware-discuss-admin@lists.sourceforge.net
[mailto:webware-discuss-admin@lists.sourceforge.net]On Behalf Of
jose@cybergalvez.com
Sent: Thursday, April 17, 2003 7:33 PM
    

  
I can't seem to get self.request().rawInput() (with or
without the rewind=1
option) to work.

Essentually I have a webpage that calls a servlet via a
form/Post and if I
then call self.writeln(self.request().rawInput()) I get back
None.  Now I
know the form is sending some data, because all it does is
send a hidden
variable.  Any thoughts as to what I am doing worng?
    

rawInput will only return a file if the data being POSTed can't be consumed
by the cgi/FieldStorage code first. If you're using a typical form posting,
then the content type would be application/x-www-form-urlencoded  and the
data from the form gets sent as encoded name value pairs. You can access
them from your servlet code using self.request().field(myFormFieldName). If
it's a multipart form, then you can get to the parts using
self.request().fieldStorage()

In either of those two cases there won't be a file available from
rawInput(), it's already been processed by that point. This shouldn't be a
problem though, as you should be able to access all the data through
self.request().field() or self.request().fieldStorage()

For content-types other than application/x-www-form-urlencoded or
multipart/form-data, you can use rawInput().

Chris



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss