<div dir="ltr"><div class="gmail_quote">On Tue, Jun 7, 2011 at 10:41,  <span dir="ltr"><<a href="mailto:michael.vancanneyt@wisa.be">michael.vancanneyt@wisa.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
<br>
On Tue, 7 Jun 2011, ik wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
One of the thing that I find really missing in fpWeb is the ability to have<br>
support for REST.<br>
<br>
That is, to place different callbacks to GET, POST, UPDATE, DELETE, HEAD and<br>
PUT.<br>
</blockquote>
<br></div>
Why do you think this is missing ? fpWeb does not really care about the method.</blockquote><div><br>That's why it is missing :)<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Let's say that I create a support for the following PATH_INFO:<br>
<br>
/records/<br>
<br>
The class should have support imho to OnGet OnPost OnDelete etc..<br>
So there will be separation of the code, while the OnRequest will fire<br>
anyway (if assigned) prior to each such request.<br>
That way, it will be easier to separate code, but remain DRY.<br>
</blockquote>
<br></div>
What is DRY (other than opposed to WET ?)</blockquote><div><br>DRY = Don't repeat yourself. so if you have to do the same task for all of the requests, you can do them there ...<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Does anyone else find such feature something that can be useful for them ?<br>
</blockquote>
<br></div>
All you need to do is<br>
<br>
  If Compare(ARequest.Method,'UPDATE') then<br>
    DoYourUpdate(ARequest); </blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
If you really want different events for the HTTP methods, you can make a<br>
descendent of TCustomHTTPModule which overrides HandleRequest() and which then<br>
examines the HTTP method and calls the appropriate callback for the various HTTP methods.<br>
<br>
It can't possibly take you more than 15 minutes to code this, plus an<br>
additional 10 to register your new module in Lazarus.<br></blockquote><div><br>I'll see how to do it on Lazarus, never done it before, and it's time to learn.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<br>
And if you care to donate it, I'll put it in FPC.<br></blockquote><div><br>I'm now testing my implementation that I called it TFPRESTWebModule. <br>When it will be ready I'll open a "bug" with feature and a patch, and send here the open bug.<br>

 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Michael.<br></blockquote><div><br>Ido<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
_______________________________________________<br>
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div><br></div>