REST Documentation Question

Home for older / inactive topics

REST Documentation Question

Postby jgarfield » Thu Jan 24, 2013 11:45 pm

Looking over the documentation I noticed something odd.

In both the ws_update and ws_create code there is a foundset.loadAllRecords(); at the end of the code.

Code: Select all
function ws_create(data,version,pk)
{
   var rec = foundset.getRecord(foundset.newRecord());

   rec.name_first = data.name_first;
   rec.name_last = data.name_last;
   rec.email = data.email;
   rec.phone_cell = data.phone_cell;
   rec.company_id = data.company_id;
   databaseManager.saveData(rec);

   foundset.loadAllRecords();
}


The doing that important or necessary? Or is it just in there by mistake?
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: REST Documentation Question

Postby ptalbot » Fri Jan 25, 2013 12:46 am

Hey James!
if you ask me, the real mistake is to use the rest plugin instead of Velocity ;)
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: REST Documentation Question

Postby jcarlos » Fri Jan 25, 2013 3:54 am

ptalbot wrote:Hey James!
if you ask me, the real mistake is to use the rest plugin instead of Velocity ;)


+1 :-)
Juan-Carlos Sanchez, Stanford University - Law and Economics
jcarlos
 
Posts: 582
Joined: Thu May 04, 2006 8:55 pm
Location: Palo Alto, California USA

Re: REST Documentation Question

Postby jgarfield » Fri Jan 25, 2013 4:59 pm

ptalbot wrote:Hey James!
if you ask me, the real mistake is to use the rest plugin instead of Velocity ;)


Well, I'm really just working on using Servoy Mobile as it is, so I don't really have a lot to do with how the REST portion of it is implemented.

That being said, if you have a strategy for deploying Mobile Apps with a combination of Servoy, Velocity, and jQuery Mobile (or some other UI framework) I would love to read up on it.
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: REST Documentation Question

Postby ptalbot » Fri Jan 25, 2013 7:19 pm

Ah ah ah! I was picking on you! :)
For mobile, there's no big strategy involved... just use whatever UI framework you like and are familiar with, then use Velocity/Servoy to build the kind of JSON required by that framework to serve data.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1659
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: REST Documentation Question

Postby rgansevles » Tue Jan 29, 2013 11:12 am

jgarfield wrote:Looking over the documentation I noticed something odd.

In both the ws_update and ws_create code there is a foundset.loadAllRecords(); at the end of the code.

Code: Select all
function ws_create(data,version,pk)
{
   var rec = foundset.getRecord(foundset.newRecord());

   rec.name_first = data.name_first;
   rec.name_last = data.name_last;
   rec.email = data.email;
   rec.phone_cell = data.phone_cell;
   rec.company_id = data.company_id;
   databaseManager.saveData(rec);

   foundset.loadAllRecords();
}


The doing that important or necessary? Or is it just in there by mistake?


The loadAllRecords call is not really needed here.
You do have to keep in mind that the rest_ws plugin uses a pool of headless clients to serve the requests.
REST defines statelessness, so each request may not depend another one.
Make sure that something like the forms foundset state left over from previous request does not affect the next request.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1929
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL


Return to Archive

Who is online

Users browsing this forum: No registered users and 3 guests

cron