Note: these comments apply to Webware 0.8. I haven't looked at CVS
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
should work fine.
From: Aaron Held [mailto:aaron@...]
Sent: Monday, April 28, 2003 3:37 PM
Cc: jose@...; webware-discuss@...
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.
Chris Prinos wrote:
<mailto:webware-discuss-admin@...> ]On Behalf Of
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
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().
This sf.net email is sponsored by:ThinkGeek <by:ThinkGeek>
Welcome to geek heaven.
Webware-discuss mailing list