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 = context().urlWithRequestHandlerKey(handlerKey, 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 = context.urlWithRequestHandlerKey(key, ...);

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

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

                        url = url.replaceAll(search, 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      (Webobjects-dev@lists.apple.com)
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