• 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, 16 Dec 2008 11:05:58 -0800


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
  • Follow-Ups:
    • Re: Problem File Upload WO 5.4 WONDER 5.0.0.8764
      • From: Sergio Sánchez Maffet <email@hidden>
References: 
 >Problem File Upload WO 5.4 WONDER 5.0.0.8764 (From: Sergio Sánchez Maffet <email@hidden>)

  • Prev by Date: Re: Weird sql generation problem running migration from WO5.4 (Oracle)
  • Next by Date: Re: New WOLips - bug when building wonder frameworks
  • Previous by thread: Problem File Upload WO 5.4 WONDER 5.0.0.8764
  • Next by thread: Re: Problem File Upload WO 5.4 WONDER 5.0.0.8764
  • Index(es):
    • Date
    • Thread