Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generate DirectAction URL with instance number when there is nosession



Hi,

Frank Caputo wrote:

just try the following code:

NSMutableDictionary dict = new NSMutableDictionary();
String actionName = "DirectAction/foo";
String queryString = WOURLEncoder.encodeAsCGIFormValues(dict);
String handlerKey = application().directActionRequestHandlerKey();

String url = "" actionName, queryString);


Unfortunately, the problem is still there : if there is no session, instance number will not be part of the generated URL. It's the case for all the WOContext methods.

So I must handle this using an hack:

public String urlWithInstanceNumber() {
WORequest request = context().request();
int instanceNumber = request.applicationNumber();
String key = WOApplication.application().directActionRequestHandlerKey();

String url = "" ...);

if(!hasSession() && (instanceNumber > -1)) {
String search, replace;

search = String.format("\\.woa/%s", key);
replace = String.format(".woa/%d/%s", instanceNumber, key);

url = "" replace);
} // if

return url;
} // urlWithInstanceNumber

For a special function, I need whenever it's possible to generate DirectAction URL including instance number. Unfortunately, if there is no session, there is no instance number in URLs using WOHyperlink, WOActionURL, WOContext, etc. And of course, I dont want to create session!

 Is there a clean way to generate such URL with instance number?

--

Francis Labrie

Saint-Bruno-de-Montarville, Québec, Canada


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden

References: 
 >RE: Generate DirectAction URL with instance number when there is nosession (From: "Frank Caputo" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.