• 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: Bug in WOContext.directActionURLForActionNamed() when using query dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in WOContext.directActionURLForActionNamed() when using query dictionary


  • Subject: Re: Bug in WOContext.directActionURLForActionNamed() when using query dictionary
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 26 Apr 2006 17:05:42 -0700

Not really sure I want to step into this... :-)

On Apr 26, 2006, at 3:49 PM, Nathan Hadfield wrote:

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 '&amp;' 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&amp;arg2=y

whereas the correct URL would be

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


There was a long discussion on the list about this within the past year. I don't recall the specifics other than something is wrong and people had a hard time agreeing on what exactly it was.

IIRC, that URL is actually _correct_ for representing a URL in an HTML file. What seems to be wrong is WO's form value processing when it gets it back. Or maybe it was a browser failing to decode it properly. I forget and I have too many headaches today to re-open this one.


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 '&amp;'.

I'm using WO 5.3 with Xcode 2.2.1. I'm pretty sure this was working correctly in earlier versions.

Correctly is perhaps open to debate, but it was working differently in earlier versions. I think this came about as part of a campaign to modernize the html that WO produces.



My workaround for now is to either replace occurrences of '&amp;' in the result with just '&'--but this would cause problems if there was a legitimate &amp; in one of the query values. Another option is include "amp;" as a prefix when retrieving form values in the direct action.

You could also make your own subclass of WOContext, and fix this method. You can call setContextClassName(java.lang.String) on Application to get it to use your subclass.



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?

Check the archives. I think there were some work arounds posted. IIRC, it was Xavier who hit this problem.


FWIW Chuck

--
Coming in late 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


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: Bug in WOContext.directActionURLForActionNamed() when using query dictionary
      • From: Mike Schrag <email@hidden>
References: 
 >Bug in WOContext.directActionURLForActionNamed() when using query dictionary (From: Nathan Hadfield <email@hidden>)

  • Prev by Date: WebObjects on Rails
  • Next by Date: MySQL JDBC Drivers
  • Previous by thread: Bug in WOContext.directActionURLForActionNamed() when using query dictionary
  • Next by thread: Re: Bug in WOContext.directActionURLForActionNamed() when using query dictionary
  • Index(es):
    • Date
    • Thread