• 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: Problems with WOAction in WO 5.3.1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with WOAction in WO 5.3.1


  • Subject: Re: Problems with WOAction in WO 5.3.1
  • From: David LeBer <email@hidden>
  • Date: Fri, 26 May 2006 10:58:27 -0400

On 26-May-06, at 10:02 AM, Dev WO wrote:

Hello David,
the handling of the request seems to have an issue if you cannot get all the parameter.


If this is not a bug and is intentional behavior, shouldn't WebObjects be able to restore the session and read the wosid in the URL?

In performActionNamed(String name) when I call existingSession() on the URL with the escaped &, WO doesn't find the session. It returns null on existingSession() for a URL like this:
.../wa/ReminderDA/refreshReminder? id=46&amp;wosid=B6fPodDWHmwlDcUs54Uaj0


However, even if I add a third parameter to the URL and use formValueForKey, it doesn't work.
.../wa/ReminderDA/refreshReminder? id=46&amp;test=hello&amp;wosid=B6fPodDWHmwlDcUs54Uaj0


formValueForKey works on id but doesn't work on test or wosid.
I'm quite surprised you cannot get wosid (or test) using formValueForKey...
The example I have in mind is using the wosid, we are not manipulating it, but the application is using it and manage the session correctly, so I think there's something...unexpected.




If I remove the escape characters, existingSession() works and formValueForKey works properly.
You can do that of course, it is just something that could break sometime as it is just not HTML.

Do you mind sending your entire method so we can have a look at it?

This looks like the same issue I documented here: <http:// david.codeferous.com/?p=191> - this is *not* fixed in the latest WO 5.3.1(Xcode 2.3) release.


The problem, if I understand it correctly, is this:

A URL on a page needs to conform to the (X)HTML spec and have '&'s encoded to '&amp;'. However, the request, sent to the server should not. URLs embedded in a page are parsed by a web browser and the ampersand decoding happens for you (you can confirm this using tcpump or tcpflow if you wish).

URLs generated by context().directActionURLForActionNamed() have encoded ampersands. Which is what you would want if that URL is going to be used on a page. However, if you use them directly to make a request to the server (via WORedirect in my case, or in a Javascript - as it appears David is doing) you need to manually remove the ampersand encoding (because the browser is not going to do it for you).

So the bug shows up because of the multiple uses for context ().directActionURLForActionNamed(). Sometimes you need an encoded URL, sometimes you don't.


Xavier

- David

-----Original Message-----
From: Dev WO [mailto:email@hidden]
Sent: Friday, May 26, 2006 5:26 AM
To: Gary Teter
Cc: David Haggerty; email@hidden
Subject: Re: Problems with WOAction in WO 5.3.1

Hello,
This is not a bug!
the & must be escaped in &amp; in a hyperlink, this is the (X)HTML
specification. It was broken in 5.2.4 and corrected in 5.3.1 because
it's the correct behavior.
The remaining bug I know of is when using the href binding with
parameters, it leads to &amp;amp; in code which is incorrect, so it
sort of a double escape.
If you are using formValueForKey it correctly gets every parameters
from the DA URL.

Xavier


Le 26 mai 06 à 00:07, Gary Teter a écrit :

Yes, this was broken in 5.3.1, but apparently fixed in 5.3.1. That
is, it was broken with the 5.3.1 that was introduced with (if I
recall) a Mac OS X Server updated), and may be fixed with the 5.3.1
that was introduced with Xcode 2.3.

(Perhaps Apple has exceeded its version number budget, and so all
future WebObjects releases will also be 5.3.1.)

The workaround is to write a method that calls WOContext's
directActionURLForActionNamed() and manually munge the URL
yourself, e.g., something like:

String url = context().directActionURLForActionNamed
("refreshReminder", getRefreshQueryDictionary());
url = url.replaceAll("&amp;", "&");
return url;

On May 25, 2006, at 2:48 PM, David Haggerty wrote:

We recently upgraded to 5.3.1 from 5.2.4 and are having problems with
WOActionURL. We use WOActionURL for Ajax and the & is adding the
HTML
escape in 5.3.1 but never did this in 5.2.4. This is causing it
to not
find the session and the URL is then invalid.


Any ideas?  Is this a bug in 5.3.1?

Thanks in advance,
David

5.3.1:
.../wa/org.yfu.ui.announcement.ReminderDA/refreshReminder?
id=46002395450
30766980&amp;wosid=B6fPodDWHmwlDcUs54Uaj0
5.2.4:
.../wa/org.yfu.ui.announcement.ReminderDA/refreshReminder?
id=46002395450
30766980&wosid=B6fPodDWHmwlDcUs54Uaj0


ActionURL1: WOActionURL { actionClass = "org.yfu.ui.announcement.ReminderDA"; directActionName = "refreshReminder"; queryDictionary = refreshQueryDictionary; }

public NSDictionary getRefreshQueryDictionary(){
return new NSDictionary(getReminderIterator().getId(), "id");
}


-- ;david

--
David LeBer
Codeferous Software
'co-defer-ous' adj. producing or containing code
site:   http://www.codeferous.com
blog: http://david.codeferous.com




Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >RE: Problems with WOAction in WO 5.3.1 (From: "David Haggerty" <email@hidden>)
 >Re: Problems with WOAction in WO 5.3.1 (From: Dev WO <email@hidden>)

  • Prev by Date: Xcode 2.3, Openbase Trouble !! Solved, Important
  • Next by Date: Re: XCode 2.3 : so far so good - ummm...
  • Previous by thread: Re: Problems with WOAction in WO 5.3.1
  • Next by thread: wo desktop image
  • Index(es):
    • Date
    • Thread