[fpc-pascal] fpWeb REST support (asking about features)
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Tue Jun 7 14:49:59 CEST 2011
On Tue, 7 Jun 2011, Ludo Brands wrote:
> TCP is the transport layer, HTTP the application layer. Don't know what a
> REST *transport layer* is, but i can guess what your question is about.
Well, I consider HTTP part of the the transport layer. The messages could be
transported over SMTP, after all. But this is just name picking :-)
> As you know REST is an architecture, not just a set of classes or methods.
> REST doesn't even require HTTP. So calling a webserver class RESTsomething
> because onGet, onPut, etc. are exposed does not have any added value.
I agree.
This was why I didn't understand the original poster's question; the
implementation is trivial.
> Is it
> going to stop a programmer to modify data in an onGet? Will it stop the
> programmer spitting out URI's that point nowhere?
>
> A class that uses fpWeb, talks directly to a Tdataset, implements the basic
> CRUD with GET,PUT,POST,DELETE and uses json,xml,... to create the reply
> would probably deserve the REST label.
Ok, that is simply an alternative to the current TFPWebDataModule which does
not rely on part of the URL to determine the CRUD action, but uses the URL
just to determine the resource, and the HTTP method to see which CRUD action
needs to be performed.
That's easily done. It's about 5 lines of code in TFPWebDataModule: 1 for
a "RESTFul" property, 4 to determine the action from the method if RESTFul is
set to True.
Do you think this would be a useful addition ?
Michael.
More information about the fpc-pascal
mailing list