Re: grabbing data from a POST
Re: grabbing data from a POST
- Subject: Re: grabbing data from a POST
- From: Chuck Hill <email@hidden>
- Date: Fri, 9 May 2008 10:07:04 -0700
On May 9, 2008, at 9:55 AM, Joshua Paul wrote:
FWIW, I get the following when grabbing this.request().contents() in
the DirectAction:
values: <class com.webobjects.appserver._private.WOInputStreamData
(stream
com.webobjects.appserver._private.WONoCopyPushbackInputStream@7f9a29
of length 418147), has NOT been accessed>
I can then write the WOInputStreamData out to disk. Within that
file, I see:
Content-Disposition: form-data; name="Filedata"; filename="image.jpg"
Content-Type: application/octet-stream
ˇÿˇ‡JFIF†€
€
C
ˇ¿ˇƒ
If I remove the 'human readable' text, I do get the image. So my
question is, is there a facility within WO to parse this out?
I am not sure what, but you are doing something wrong or have
something setup wrong or are getting a malformed HTTP request (user-
agent = (CFNetwork/221.5);).
You should just get the binary form value. Try a real browser.
Chuck
On May 9, 2008, at 2:14 AM, Stefan Klein wrote:
Hi,
seems to be a problem with FileUpload. I never done this using a
direct action.
I think the following may be a good starting point:
http://www.mail-archive.com/email@hidden/msg04304.html
Stefan
Joshua Paul schrieb:
headers: {remote_host = (::1); user-agent = (CFNetwork/221.5);
document_root = (/Library/WebServer/Documents); server_name =
(localhost); accept = (*/*); remote_addr = (::1); content-type =
("multipart/form-data, boundary=0194784892923"); server_admin = (email@hidden
); remote_port = (55798); connection = (close); server_software =
(Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7l DAV/2); host =
(localhost); accept-encoding = (gzip, deflate); x-webobjects-
request-id = (482352030000001c000000af); script_uri = (http://localhost/cgi-bin/WebObjects/Ducere.woa/-5555/wa/uploadImage
); accept-language = (en-us); script_url = (/cgi-bin/WebObjects/
Ducere.woa/-5555/wa/uploadImage); x-webobjects-request-method =
(POST); x-webobjects-adaptor-version = ("Apache"); content-length
= ("435492"); script_filename = (/cgi-bin); server_port = (0); }
keys: null
values: null
On May 9, 2008, at 12:26 AM, Stefan Klein wrote:
Hi,
what did you see using:
NSLog.debug.appendln("headers: " + request().headers());
NSLog.debug.appendln("keys: " + request().formValueKeys());
NSLog.debug.appendln("values: " + request().formValues());
Stefan
Joshua Paul schrieb:
That's just it, when I do that I get a NPE.
If I grab this.request().content() and write it to disk, I can
see that the data is there (Content-Disposition, etc.).
Other thoughts?
On May 9, 2008, at 12:16 AM, Stefan Klein wrote:
Hi,
you can use request().formValueForKey("Filedata") in your
DirectAction
Stefan
Joshua Paul schrieb:
I have data coming into my app via a POST in a DirectAction. I
can obtain the data via:
(WOInputStreamData) this.request().content()
But that's where I'm stumped. Once I've grabbed the raw data,
how can I extract the form information/data from it?
Content-Disposition: form-data; name="Filedata";
filename="image.jpg"
Content-Type: application/octet-stream
ˇÿˇ‡JFIF†€
€
C
ˇ¿ˇƒ
TIA.
--
Josh Paul
email@hidden
twitter: joshpaul
linkedin: joshpaul
NOTICE: This e-mail message and all attachments transmitted with it
are intended solely for the use of the addressee and may contain
legally privileged and confidential information. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution,
copying, or other use of this message or its attachments is strictly
prohibited. If you have received this message in error, please
notify the sender immediately by replying to this message and please
delete it from your computer.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden