Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 2 of 2 total |
Build own HTTP Server |
Thu, Mar 21 2013 11:15 AM | Permanent Link |
Walter Matte Tactical Business Corporation | FYI - in case anyone else builds a Server to respond to Database.Load and Database.Commit request from EWB apps. (EWB 1.01 b5)
Everything worked without issue on IE and FF. Chrome and Mobile Browsers gave me Error: Database commit response error. There are two things to work around. One in the JS and one in your Server. 1. First you need to manually remove the one Content-Length command in the JS file. (Tim is fixing this for the next release.) It will be in the .commit() function: This Line - remove it. It should not be there. It does not bother IE or FF - but Chrome and Mobile browsers fail. temprequest.tserverrequest_frequestheaders.tstrings_setvalue("Content-Length", inttostr(length(temprequest.tserverrequest_frequestcontent.gettext()))); If you have Compress Code - just search for Content-Length (there is only one) and remove. Each line is delimited with ; so from after the ; to the next - remove. It will look something like this: e4.E_e8.O_hx("Content-Length",c3(ca(e4.E_hl.bC()))); 2. Chrome Browsers issue an HTTP OPTIONS request prior to the HTTP POST generated by a Database.Commit. So your sever needs to respond to an OPTIONS request. Here is the code I have - I use RealThinClient components for my HTTP Server - that responds to the OPTIONS request. // ============================================================================ // Commit Data // ============================================================================ procedure TdmRTCProviders.dpCommitCheckRequest(Sender: TRtcConnection); begin with Sender as TRtcDataServer do begin if (Uppercase(Request.FileName)) = '/DATASET' then Accept; end; end; // Respond procedure TdmRTCProviders.dpCommitDataReceived(Sender: TRtcConnection); var Conn : IUniSQLPool; sJson : string; i : integer; begin with Sender as TRtcDataServer do begin if (Request.Method='OPTIONS') then begin if Request.Complete then begin for i := 0 to Request.ItemCount - 1 do if Uppercase(request.ItemName[i]) = 'ACCESS-CONTROL-REQUEST-HEADERS' then Response.HeaderText := Response.HeaderText + RtcString('Access-Control-Allow-Headers: ' + request.ItemValue[i] + #13#10); Response.HeaderText := Response.HeaderText + RtcString('Access-Control-Allow-Origin: *' + #13#10) + RtcString('Access-Control-Allow-Methods: POST,GET,OPTIONS' + #13#10) + RtcString('Allow: POST,GET,OPTIONS' + #13#10) + RtcString('Public: POST,GET,OPTIONS' + #13#10); Write(RtcString('')); end; end else begin Request.Params.AddText(Read); if (Request.Complete) then begin Conn := FConnections.LockConnection; try sJson := Request.Params.Text; Response.HeaderText := Response.HeaderText + RtcString('Access-Control-Allow-Origin: *' + #13#10) + RtcString('Cache-Control: must-revalidate, post-check=0, pre-check=0' + #13#10) + RtcString('Cache-Control: no-cache, no-store' + #13#10); Write(RtcString(Conn.EWBCommit(sJson))); finally FConnections.UnlockConnection(Conn); end; end; end; end; end; Walter |
Thu, Mar 21 2013 2:46 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Walter,
<< FYI - in case anyone else builds a Server to respond to Database.Load and Database.Commit request from EWB apps. (EWB 1.01 b5) >> Thanks, also very good information. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, December 1, 2024 at 03:59 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |