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?