• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem File Upload WO 5.4 WONDER 5.0.0.8764
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem File Upload WO 5.4 WONDER 5.0.0.8764


  • Subject: Re: Problem File Upload WO 5.4 WONDER 5.0.0.8764
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 13 Jan 2009 18:27:06 -0800

Hi Sergio,


On Dec 31, 2008, at 9:23 AM, Sergio Sánchez Maffet wrote:

Chuck,

finally I got it running. Thanks a lot for your help. The language is set to German and the default form value encoding for German is iso8859-1 in ERXMessageEncoding.

That seems a little odd. That class is pretty old, so this might be from long ago.



After setting the encoding with setDefaultEncodingForAllLanguages to UTF-8, I got it running. Dont know if this is some kind of a bug, the encoding should be set to the request encoding and this is/was UTF-8...
I have also noticed, that this is a general problem... not only related to file uploads...


Do I have a miss understanding here?

You _might_ be missing something from your Properties file. I don't do much with this part of Wonder. I can't think of a good reason to have a web app that is not UTF-8. You might want to ask this on the Wonder list.



Chuck



On 16.12.2008, at 20:05, Chuck Hill wrote:


On Dec 15, 2008, at 5:31 PM, Sergio Sánchez Maffet wrote:

Hi all,

I have some problems regarding file uploads with WO 5.4.3. When I submit the form, my action method is called, but the form values get lost some where in the request processing. The page is very simple, only a text field and a file upload inside a form and a submit button.
Every thing is binded correctly and it has worked with WO 5.3. I'm using WONDER 5.0.0.8764 for WO 5.4. The application is running in direct connect mode, and session id's are stored in a cookies... dont know if this has some importance.


The problem mentioned by William Hatch (Subject: WOFileUpload and 5.4, from 10/30/08) seems to be similar, but there is was solution posted.
As Chuck mentioned, form values can get lost when the encoding changes during the request, this seems to happen in my case, but I do not understand why?


Here is a log of the request in dispatchRequest() and in the same thread later in takeValueFromRequest():

Dec 16 02:01:46 MyApplication[3004] DEBUG NSLog - dispatchRequest: <er.extensions.appserver.ERXRequest (<er.extensions.appserver.ERXRequest httpVersion=HTTP/1.1 headers={accept=[text/xml,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=[851656], content- type=[multipart/form-data; boundary=---- WebKitFormBoundaryoAlLNzXKfp0pQVgV], cookie=[wosid=JqNtBIQBjJoJDvcBQt4bAw; woinst=-1], host=[192.168.4.35:3004], referer=[http://192.168.4.35:3004/cgi-bin/WebObjects/MyApplication.woa/wo/6.5 ], user-agent=[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1]} content-length=851656 cookies=null userInfo={} storePageInBacktrackCache=true >) method=POST uri=/cgi-bin/ WebObjects/MyApplication.woa/wo/7.5 defaultFormValueEncoding=UTF-8 formValueEncodingDetectionEnabled=NO formValueEncoding=UTF-8 formValues={5.1 = ("Test 1"); 5.3.mimetype = ("image/jpeg"); 5.3.filename = ("DSC00033.JPG"); 5.3 = (<class com.webobjects.appserver._private.WOInputStreamData (stream com.webobjects.appserver.WOMultipartIterator$WOFormData $_WOFormDataInputStream@ee68d1 of length 0), has NOT been accessed>); } >


Dec 16 02:01:46 MyApplication[3004] DEBUG NSLog - takeValuesFromRequest: <er.extensions.appserver.ERXRequest (<er.extensions.appserver.ERXRequest httpVersion=HTTP/1.1 headers={accept=[text/xml,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=[851656], content- type=[multipart/form-data; boundary=---- WebKitFormBoundaryoAlLNzXKfp0pQVgV], cookie=[wosid=JqNtBIQBjJoJDvcBQt4bAw; woinst=-1], host=[192.168.4.35:3004], original_context_id=[7], referer=[http://192.168.4.35:3004/cgi-bin/WebObjects/MyApplication.woa/wo/6.5 ], user-agent=[Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1]} content-length=0 cookies=null userInfo={} storePageInBacktrackCache=true >) method=POST uri=/cgi-bin/ WebObjects/MyApplication.woa/wo/7.5 defaultFormValueEncoding=ISO8859_1 formValueEncodingDetectionEnabled=NO formValueEncoding=ISO8859_1 formValues={} >


I have tried to set the form value encoding to UTF-8 in the dispatchRequest() method with no luck, I also tried WOFileUpload and ERXWOFileUpload.
Any clues or ideas to fix it?


Sergio,

This is what I would do to track this down:

1. Create a subclass of ERXRequest and implement these methods:
setDefaultFormValueEncoding(String value)
setFormValueEncoding(String value)

to be like:
public void setDefaultFormValueEncoding(String value)  {
	NSLog.out.appendln(new RuntimeException("set to " + value));
	super.setDefaultFormValueEncoding(value);
}



2. In your Application class, implement _createRequest as

protected WORequest _createRequest(String aMethod, String aURL, String anHTTPVersion, NSDictionary someHeaders, NSData aContent, NSDictionary someInfo) {
if (anHTTPVersion == null || anHTTPVersion.startsWith("INCLUDED")) {
anHTTPVersion = "HTTP/1.0";
}

if ("GET".equalsIgnoreCase(aMethod) && someHeaders != null && someHeaders.objectForKey("content-type") != null)
{
someHeaders = someHeaders.mutableClone();
((NSMutableDictionary)someHeaders).removeObjectForKey("content- type");
}


		if (rewriteDirectConnectURL()) {
			aURL = "/cgi-bin/WebObjects/" + name() + ".woa" + aURL;
		}


NOTE THE NEXT LINE!

WORequest worequest = new <YOUR REQUEST CLASS HERE>(aMethod, aURL, anHTTPVersion, someHeaders, aContent, someInfo);
return worequest;
}



That will give you a stack trace to the code that is setting the form encoding to ISO8859_1. With that knowledge, we should be closer to a solution.


Chuck

--
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


-- 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
  • Prev by Date: Re: split install issue with 5.4.3
  • Next by Date: Re: Determining which bundle an EOModel comes from
  • Previous by thread: Re: OpenBase & WebObjects for scaling
  • Next by thread: Bug in NSTimeZone: rawOffset is wrong
  • Index(es):
    • Date
    • Thread