![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Fri, Sep 12 2014 12:38 PM | Permanent Link |
Bruno Larochelle | I am trying to understand how to use TServerRequestQueue
Can someone provide a few hints? I know that I need to 'getNewRequest' and then 'addNewRequest' But for the life of me I can't understand how to 'trigger' the requests using the 'queue'. (I've used TServerRequest before.. I now want to serialize a few of them.. hence uses of the queue) many thanks in advance Bruno Larochelle Logiciels Bitwise Software |
Fri, Sep 12 2014 1:18 PM | Permanent Link |
Walter Matte Tactical Business Corporation | I cut this example out of example posed here:
http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_demos&page=1&msg=38#38 Function TForm1.Doregister(email,Mypass,company,contact,telephone:String):Boolean; Var MyLogin : String; MyPassword : String; MyServerRequest : TServerRequest; begin Result:=True; MyserverRequest:=RequestQueue.GetNewRequest; with MyServerRequest do begin Myserverrequest.ResponseContent.LineSeparator:=#13+#10; Myserverrequest.OnComplete:=RequestComplete; URL := 'register-exec.php'; RequestHeaders.Values['Content-Type'] := 'multipart/form-data; boundary=AaB03x'; with RequestContent do begin Add('--AaB03x'); Add('Content-Disposition: form-data; name="email"'); Add(''); Add(email); Add('--AaB03x'); Add('Content-Disposition: form-data; name="password"'); Add(''); Add(MyPass); Add('--AaB03x'); Add('Content-Disposition: form-data; name="company"'); Add(''); Add(Company); Add('--AaB03x'); Add('Content-Disposition: form-data; name="contact"'); Add(''); Add(Contact); Add('--AaB03x'); Add('Content-Disposition: form-data; name="telephone"'); Add(''); Add(telephone); Add('--AaB03x'); end; Method := rmPost; //RequestQueue:=TServerRequestQueue.Create(nil); RequestQueue.AddRequest(MyserverRequest); // Execute; end; end; Walter |
Fri, Sep 12 2014 2:02 PM | Permanent Link |
Bruno Larochelle | thanks Walter for the prompt response
what still eludes me somewhat is 'what triggers the requests?' in the example, the '.execute' is remmed out .. presumably gets done elsewhere in the code the queue has several requests, presumably, so how do I get them to start .. by calling the 'execute' on any one of them that is in the queue? Or do I call 'execute' on all of them -- and that they individually will only execute if the prior one in the list is done? I guess I would have expected that 'TServerRequestQueue' would have had a method to 'execute' once it is populated with requests. But it has no methods. I will continue experimenting. Once I understand, I will go 'ahhhhh' ![]() Bruno // Walter Matte wrote: I cut this example out of example posed here: http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_demos&page=1&msg=38#38 |
Fri, Sep 12 2014 3:01 PM | Permanent Link |
Walter Matte Tactical Business Corporation | There is an example in the Help too.... - while not explicitly stated and I have not tried the TServerRequestQueue - I would think it executes upon the AddRequest() - meaning if it is the first in the queue it executes it and when it is done, if there are more they get executed.
Walter Bruno Larochelle wrote: thanks Walter for the prompt response what still eludes me somewhat is 'what triggers the requests?' in the example, the '.execute' is remmed out .. presumably gets done elsewhere in the code the queue has several requests, presumably, so how do I get them to start .. by calling the 'execute' on any one of them that is in the queue? Or do I call 'execute' on all of them -- and that they individually will only execute if the prior one in the list is done? I guess I would have expected that 'TServerRequestQueue' would have had a method to 'execute' once it is populated with requests. But it has no methods. I will continue experimenting. Once I understand, I will go 'ahhhhh' ![]() Bruno // Walter Matte wrote: I cut this example out of example posed here: http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_demos&page=1&msg=38#38 |
Fri, Sep 12 2014 3:37 PM | Permanent Link |
Bruno Larochelle | thanks again Walter, I had not noticed there was more to the example (needed to scroll down), and it indeed looks like it works as you suggest. A the snippet (from the EWB help) shows:
procedure TMyForm.GetCustomerClick(Sender: TObject); var TempRequest: TServerRequest; begin TempRequest:=MyRequestQueue.GetNewRequest; TempRequest.URL:='/customer'; TempRequest.Params.Add('method=info'); TempRequest.ResponseContent.LineSeparator:=#10; TempRequest.OnComplete:=RequestComplete; MyRequestQueue.AddRequest(TempRequest); end; So, then .. ahhhhh! ![]() .. Bruno Walter Matte wrote: There is an example in the Help too.... - while not explicitly stated and I have not tried the TServerRequestQueue - I would think it executes upon the AddRequest() - meaning if it is the first in the queue it executes it and when it is done, if there are more they get executed. Walter |
This web page was last updated on Tuesday, November 28, 2023 at 10:08 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |