Re: ERRest tutorial
Re: ERRest tutorial
- Subject: Re: ERRest tutorial
- From: Pascal Robert <email@hidden>
- Date: Mon, 02 Jan 2012 14:15:41 -0500
Le 2012-01-02 à 14:04, Pascal Robert a écrit :
>
> Le 2012-01-02 à 13:09, Alexis Tual a écrit :
>
>> Hi Pascal and the list, best wishes for 2K12 !
>>
>> Thanks for this tutorial, but I have some questions :
>> - Where is the "new Wonder REST Application" wizard ? I can't see it in my current WOLips (v 3.7.1002088)
>
> It's in my fork of WOLips. I have a problem with it, I can create a project from the template by doing File -> New -> Other -> WO Project from Template, but I get an exception when doing it from File -> New.
Exact + an route so that the default request handler is the REST one + a route to redirect the main page to Main.wo.
https://github.com/pascalrobert/wolips/commit/c7e2398ec24425271ac26f54ef212c7f369ac69e
>> - "Last step in the controller: implementing the showAction method. Again, the code is simple:" it's rather the indexAction
>> - A more general concern about html routing, other rest frameworks (rails, grails) use actions also when there's html routing. With ERRest as I understand, the isAutomaticHtmlRoutingEnabled bypasses the actions to directly render the views.
>
> It only bypass actions when you use the convention <EntityName><Action>Page, if the view component have a different name, it falls back to the action. If you fall back to the action, you check if the format is HTML (like you did in your example :-)).
>
>> Instead too use the same actions for json,xml or html formats, I would do :
>>
>> @Override
>> public WOActionResults indexAction() throws Throwable {
>> NSArray<BlogEntry> entries = BlogEntry.fetchAllBlogEntries(editingContext());
>> WOActionResults response;
>> if (format().equals(ERXRestFormat.html())) {
>> BlogEntryIndexPage index = pageWithName(BlogEntryIndexPage.class);
>> index.setEntries(entries);
>> response = index;
>> } else {
>> response = response(entries, filter());
>> }
>> return response;
>> }
>> This, to avoid duplicating some logic (the fetchAll stuff).
>>
>> Thansk again !
>>
>> Alex
>>
>> Le 29 déc. 2011 à 14:32, Pascal Robert a écrit :
>>
>>> Hello everyone,
>>>
>>> I wrote a mini ERRest tutorial that will be part of a larger "Getting Started with Project Wonder" tutorial. It's in the wiki:
>>>
>>> http://wiki.wocommunity.org/display/WONDER/Your+First+Rest+Project
>>>
>>> The only thing missing is screen shots, I will add them after I get to resolve the problem with adding a REST template in WOLips…
>>>
>>> _______________________________________________
>>> 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
>>
>
> _______________________________________________
> 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
_______________________________________________
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