• 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: resRouteURLForActionNamed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resRouteURLForActionNamed?


  • Subject: Re: resRouteURLForActionNamed?
  • From: Mike Schrag <email@hidden>
  • Date: Fri, 29 Apr 2011 09:35:59 -0400

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.

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@hidden

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@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: resRouteURLForActionNamed?
      • From: Pascal Robert <email@hidden>
References: 
 >resRouteURLForActionNamed? (From: Pascal Robert <email@hidden>)
 >Re: resRouteURLForActionNamed? (From: Pascal Robert <email@hidden>)

  • Prev by Date: Re: resRouteURLForActionNamed?
  • Next by Date: PushToTest / Glassbox
  • Previous by thread: Re: resRouteURLForActionNamed?
  • Next by thread: Re: resRouteURLForActionNamed?
  • Index(es):
    • Date
    • Thread