persistance api: empty crud response how-to

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

persistance api: empty crud response how-to

koenvdk
Hi,

I've been working on my own persistance implementation for form runner. It's a Java Servlet web service which directly speaks to mysql, using orbeon's traditional datamodel for mysql.

So far, I have some pretty good results, however, the CRUD operations that result in not-found errors are causing me problems. What exactly should the api return in this case?
Most importantly, what should a CRUD GET return when nothing was found? I returned really nothing and this causes serious trouble for the form builder, when it is looking for nonexistant library forms (the controls don't get loaded). So what should exactly be returned in those cases? I checked in ther browser, and it seems to be an empty file, but I don't know how to do that using javax.servlet, and I don't know which response code, etc...

What doens't cause trouble (yet) is PUT: but just in case: what should PUT respond with when something goes awry?.


Koen Vanderkimpen

Connect: Twitter









Overeenkomstig de bepalingen inzake de vertegenwoordiging van de vzw in haar statuten, kan enkel de gedelegeerde bestuurder, de algemeen directeur of zijn uitdrukkelijke lasthebber verbintenissen aangaan namens Smals.
Indien dit bericht niet voor u bestemd is, verzoeken wij u dit onmiddellijk aan ons te melden en het bericht te vernietigen.

Conformément aux dispositions relatives à la représentation de l'asbl dans ses statuts, seul l'administrateur délégué, le directeur général ou son mandataire exprès est habilité à souscrire des engagements au nom de Smals.
Si ce message ne vous est pas destiné, nous vous prions de nous le signaler immédiatement et de détruire le message.

According to the provisions regarding representation of the non profit association in its bylaws, only the chief executive officer, the general manager or his explicit agent can enter into engagements on behalf of Smals.
If you are not the addressee of this message, we kindly ask you to signal this to us immediately and to delete the message.





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: persistance api: empty crud response how-to

jpenninkhof
Hi Koen,

I ran into the same issue with the missing form controls. I found out that when you return http status 404 (not found) on a CRUD GET, this issue is resolved.
If a PUT goes bad, I return a 500 (server error), but that doesn't seem to have any effect on form builder. At least, it doesn't cascade this status for some reason to the user. From a REST perspective this sounded like the most obvious choice though.

Cheers,
Jan

On Fri, Jun 15, 2012 at 8:17 AM, <[hidden email]> wrote:
Hi,

I've been working on my own persistance implementation for form runner. It's a Java Servlet web service which directly speaks to mysql, using orbeon's traditional datamodel for mysql.

So far, I have some pretty good results, however, the CRUD operations that result in not-found errors are causing me problems. What exactly should the api return in this case?
Most importantly, what should a CRUD GET return when nothing was found? I returned really nothing and this causes serious trouble for the form builder, when it is looking for nonexistant library forms (the controls don't get loaded). So what should exactly be returned in those cases? I checked in ther browser, and it seems to be an empty file, but I don't know how to do that using javax.servlet, and I don't know which response code, etc...

What doens't cause trouble (yet) is PUT: but just in case: what should PUT respond with when something goes awry?.


Koen Vanderkimpen


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: persistance api: empty crud response how-to

Erik Bruchez
Administrator
In reply to this post by koenvdk
Koen,

So far, I have some pretty good results, however, the CRUD operations that result in not-found errors are causing me problems. What exactly should the api return in this case?

HTTP 404 not found.
 
Most importantly, what should a CRUD GET return when nothing was found?

HTTP 404 not found ;)
 
I returned really nothing and this causes serious trouble for the form builder, when it is looking for nonexistant library forms (the controls don't get loaded). So what should exactly be returned in those cases? I checked in ther browser, and it seems to be an empty file, but I don't know how to do that using javax.servlet, and I don't know which response code, etc...

What doens't cause trouble (yet) is PUT: but just in case: what should PUT respond with when something goes awry?.

Any non-success HTTP code, such as 500.

Note that we have this known issue we are hoping to fix for 4.0:


-Erik


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws