RE: dispatchRequest not seeing InputStream data from uploadFile request
RE: dispatchRequest not seeing InputStream data from uploadFile request
- Subject: RE: dispatchRequest not seeing InputStream data from uploadFile request
- From: Carlos Maldonado <email@hidden>
- Date: Mon, 3 Aug 2009 11:04:41 -0700
- Acceptlanguage: en-US
- Thread-topic: dispatchRequest not seeing InputStream data from uploadFile request
Yep, I'm using WOnder.
Incredible as it may sound, added the 'name' attribute to the WOFileUpload element in wod and worked!
This thing is like something you wouldn't think make the difference.
This is basically what I did:
-took the DA from FileUpload project in Examples folder, where they use the Iterator to upload the file and added the 'name' attribute to the WOFileUpload element, as that DA seeks for the name of the WOFileUpload and ta-dah!.. worked!
Thanks!
-Carlos
________________________________________
From: Chuck Hill [email@hidden]
Sent: Friday, July 31, 2009 2:10 PM
To: Carlos Maldonado
Cc: email@hidden
Subject: Re: dispatchRequest not seeing InputStream data from uploadFile request
On Jul 31, 2009, at 1:49 PM, Carlos Maldonado wrote:
> Hi,
>
> I'm debugging an app and can't find the exact cause of loosing the
> contents of a file being uploaded. I know WO is capable of uploading
> files, that's not the issue, even I tested using XCode with WO5.3 in
> Tiger, Eclipse with WO5.4 in Leopard and finally using Eclipse with
> WOnder 5.4 in Leopard. All worked with no problems. If I needed to
> grab the file contents I could do it either in createRequest,
> dispatchRequest or in the DA method or the action object-method in
> case I wanted not to use DAs.
>
> But then I moved to the non-working app and I can see file contents
> in createRequest method --I can even save the file-- but as soon as
> execution gets to dispatchRequest, and though I get a valid object
> when I issue the call InputStream input =
> part.formDataInputStream(); --input is valid object-- I don't get
> any data from the call input.read(buffer, offset, length - offset);
> or input.available() all I get is a -1 which means there's no data.
>
> I don't have an awake method, that I think is the next method in
> execution after createRequest gets called and before dispatchRequest
> gets called too.
>
> Does anybody had experienced something simliar? or have a clue of
> what could be causing to loose data?. I checked the encoding for the
> WOComponent and is set to UTF-8, so defaultFormValueEncoding=UTF-8
> and formValueEncoding=UTF-8 are the same.
I'm not sure where, but I think the encoding is getting changed. Are
you using Wonder in this app? If yes, add this to the Properties file:
er.extensions.ERXApplication.DefaultEncoding= UTF-8
Chuck
> Here's the request that doesn't upload, see if someone can see it
> different from "normal":
> <com.webobjects.appserver.WORequest
> (<com.webobjects.appserver.WORequest httpVersion=HTTP/1.1
> headers={accept=[application/xml,application/xhtml+xml,text/
> html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5], accept-
> encoding=[gzip, deflate], accept-language=[en-us], connection=[keep-
> alive], content-length=[14000], content-type=[multipart/form-data;
> boundary=----WebKitFormBoundaryZ5DtuOIpu8QIP+zn], host=[localhost:
> 11021], origin=[http://localhost:11021], referer=[http://localhost:11021
> /cgi-bin/WebObjects/LSDesktopServer.woa/wa/uploadFile], user-
> agent=[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us)
> AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/
> 530.19]} content-length=0 cookies=null userInfo={}
> storePageInBacktrackCache=true >) method=POST uri=/cgi-bin/
> WebObjects/LSDesktopServer.woa/wa/uploadPenDataMetrics?
> filePathToUpload=/tmp
> /Hola.java&userToken=090749684221rSHxwWRjQjhN
> defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO
> formValueEncoding=UTF-8 formValues={1.0.mimetype = ("application/
> octet-stream"); 1.0.filename = ("Hola1.java"); 1.0 = ( <class
> com.webobjects.appserver._private.WOInputStreamData (stream
> com.webobjects.appserver.WOMultipartIterator$WOFormData
> $_WOFormDataInputStream@7689bc of length 0), has NOT been
> accessed> ); } >
>
>
> -Carlos
> _______________________________________________
> 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
--
Chuck Hill Senior Consultant / VP Development
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