You are not logged in.
Pages: 1
Hi Arnaud,
Project 13 - StandAlone JSON SQL server:
-------------------------------------------
When compiled with Delphi 7, then I run JsonSQLClient.exe, it returns JSON as expected, but if I compile the same project with Delphi XE2, nothing happens, just a black a screen.
Project 04 - HTTP Client-Server:
--------------------------------
There're problems with Firefox 6 and IE 6.
When I type into the address bar:
http://localhost:8080/root/SampleRecord
- I don't see any result of all SampleRecord IDs, encoded as a JSON list.
It appears a popup download window asking to download the file "SampleRecord
"
With FF 8, everything is OK.
Offline
Ensure you use the latest 1.18 unstable version from http://synopse.info/fossil/wiki?name=Get+the+source - and follow associated SAD documentation.
Here is what the 1.18 SAD pdf states:
The "04 - HTTP Client-Server" sample application available in the framework source code tree can be used to show how the framework is AJAX-ready, and can be proudly compared to any other REST server (like CouchDB) also based on JSON.
First desactivate the authentication - see 18 - by changing the parameter from true to false in Unit2.pas:
DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'), false);
and by commenting the following line in Project04Client.dpr:
Form1.Database := TSQLHttpClient.Create(Server,'8080',Form1.Model);
// TSQLHttpClient(Form1.Database).SetUser('User','synopse');
Application.Run;
Then you can use your browser to test the JSON content:
- Start the Project04Server.exe program: the background HTTP server, together with its SQLite3 database engine;
- Start any Project04Client.exe instances, and add/find any entry, to populate the database a little;
- Close the Project04Client.exe programs, if you want;
- Open your browser, and type into the address bar:
http://localhost:8080/root
- You'll see an error message:
TSQLHttpServer Server Error 400
- Type into the address bar:
http://localhost:8080/root/SampleRecord
- You'll see the result of all SampleRecord IDs, encoded as a JSON list, e.g.
[{"ID":1},{"ID":2},{"ID":3},{"ID":4}]
- Type into the address bar:
http://localhost:8080/root/SampleRecord/1
- You'll see the content of the SampleRecord of ID=1, encoded as JSON, e.g.
{"ID":1,"Time":"2010-02-08T11:07:09","Name":"AB","Question":"To be or not to be"}
- Type into the address bar any other REST command, and the database will reply to your request...
You have got a full HTTP/SQLite3 RESTful JSON server in less than 400 KB.
Offline
Is very strange here, Project 04 is working fine with FF 8, but not in [FF 6, IE6]. It shows a download window asking to download the file "SampleRecord".
Project 13, when compiled with X2 then run JsonSQLClient.exe, don't display the json result, but with D7, it returns as expected!
Note: authentication is disabled; I have 9 records in SampleRecord table; I comment user/pass in proj; mORMot sources downloaded yesterday.
Last edited by warleyalex (2013-03-14 23:40:05)
Offline
This is a bug of IE and FF6.
See https://github.com/blueimp/jQuery-File- … issues/123
They do not recognize the "application/json; charset=UTF-8" header as some text to be displayed.
Known workaround is described at http://www.codeproject.com/Tips/216175/ … t-Explorer
So direct access to the JSON content won't work with those browsers.
But when load from javascript/AJAX, it will work as expected.
In all cases, you won't use a browser to display JSON to your end users, right?
I've updated the SAD to explicitly states this limitation.
I just compiled "Project 13 - StandAlone JSON SQL server" both client and server projects with XE3, and it works as expected.
Even in 32 bit and 64 bit mode !
With latest 1.18 unstable version, of course!
Offline
Pages: 1