probably not exactly what you want, but there's ERXRouteUrlUtils ... it's 
making a bunch of assumptions about the route syntax, though.

On Apr 29, 2011, at 10:39 AM, Pascal Robert wrote:

> 
> Le 2011-04-29 à 09:35, Mike Schrag a écrit :
> 
>> you would have to replace them yourself, but it's sort of unclear what you 
>> would replace them WITH ... they're not valid urls without having an actual 
>> value in those slots.
> 
> Yes, I do know that for "show" pages, I will have to add the IDs myself. 
> That's not only for the manifest, I'm also playing with the automatic HTML 
> routing to make the WOWODC mini app (to view the schedule + the presenters) 
> so I need to generate the URLs to go from the "index" page (list of 
> presentations) to the session detail page. If we had a "restRouteUrl" method, 
> I would just need to add the ID of the conference session object to the URL 
> returned by "restRouteUrl". 
> 
>> On Apr 29, 2011, at 9:30 AM, Pascal Robert wrote:
>> 
>>> 
>>> Le 2011-04-28 à 20:23, Pascal Robert a écrit :
>>> 
>>>> Yes, I know that method doesn't exist, but I'm looking for something that 
>>>> would generate the URL (without the host) for the routes. The reason? I 
>>>> want to add them to a HTML5 cache manifest so if I could dynamically 
>>>> generate the list of URLs, that would be cool! I didn't see anything 
>>>> obvious for this in ERXRoute or ERXRouteRequestHandler.
>>>> 
>>>> So, how can I find those URLs a la directActionURLForActionNamed but for 
>>>> REST routes (especially the ones using HTTP GET)? 
>>> 
>>> I was able to do part of it like this:
>>> 
>>> public WOActionResults manifestAction() {
>>>   WOResponse response = new WOResponse();
>>>   StringBuffer content = new StringBuffer();
>>>   content.append("CACHE MANIFEST\n");
>>>   content.append("CACHE:\n");
>>>   String baseUrl = 
>>> this.context()._urlWithRequestHandlerKey(ERXRouteRequestHandler.Key, null, 
>>> null, false);
>>>   content.append(baseUrl + "/sessions.html" + "\n");
>>>   response.setContent(content.toString());
>>>   response.setHeader("text/cache-manifest", "Content-Type");
>>>   return response;
>>> }
>>> 
>>> That work, but I still have to add the last part of the URL. I tried with:
>>> 
>>>   for (ERXRoute route: Application.restRequestHandler().routes()) {
>>>       if (Method.Get.equals(route.method())) {
>>>         content.append(baseUrl + route.routePattern().toString + "\n");
>>>       }
>>>     }
>>> 
>>> But I didn't find a way remove the regex constructs (I guess I would use 
>>> string.replace to remove them).
>>> 
>>> 
>>> --
>>> Pascal Robert
>>> [email protected]
>>> 
>>> WOWODC 2011 : July 1-2-3, Montreal. wowodc.com
>>> 
>>> AIM/iChat : MacTICanada
>>> LinkedIn : http://www.linkedin.com/in/macti
>>> Twitter : pascal_robert
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      ([email protected])
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
>>> 
>>> This email sent to [email protected]
>> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
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