I seem to have encountered a bug in WOContext.directActionURLForActionNamed(). When I pass it a query dictionary containing more than one key, it returns a string in which the query arguments are separted by '&' instead of just an ampersand. As a result, if I pass a query dictionary containing { arg1 = x; arg2 = y }, it returns a URL looking like this:

        /cgi-bin/WebObjects/AppName.woa/wa/MyActions/go?arg1=x&arg2=y

whereas the correct URL would be

        /cgi-bin/WebObjects/AppName.woa/wa/MyActions/go?arg1=x&arg2=y

I have traced the problem down to a the private static method
        
com.webobjects.appserver._private.WOURLEncoder.encodeAsCGIFormValues ( NSDictionary dict )

which returns the encoded pairs joined by '&'.

I'm using WO 5.3 with Xcode 2.2.1. I'm pretty sure this was working correctly in earlier versions. My workaround for now is to either replace occurrences of '&' in the result with just '&'--but this would cause problems if there was a legitimate & in one of the query values. Another option is include "amp;" as a prefix when retrieving form values in the direct action.

I have submitted a bug report to Apple but I'm curious whether anyone else has encountered this, or if anyone has a better workaround?

Thanks,
Nathan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to