#1 mORMot 1 » How to Decrease Request Header Output? » 2019-01-30 17:34:06

Desenvolvimento
Replies: 1

Is it possible to change this?

HTTP/1.1 200
status: 200
Content-Type: application/json; charset=UTF-8
Server: mORMot (Windows) Microsoft-HTTPAPI/2.0
X-Powered-By: mORMot 1.18 synopse.info

Accept-Encoding: deflate
Date: Wed, 30 Jan 2019 17:03:35 GMT
Content-Length: 18

to

HTTP/1.1 200
status: 200
Content-Type: application/json; charset=UTF-8
Accept-Encoding: deflate
Content-Length: 18

tks

#2 mORMot 1 » Possible bug - unit Mormot>TJSONObjectDecoder.Decode method » 2017-10-19 14:51:57

Desenvolvimento
Replies: 1

Hello ab,

I think I found a bug. There is a limit of 64 fields that a table can have, right?

In the unit, Mormot, in the TJSONObjectDecoder.Decode method, line 27448, the number of fields is checked equal to the limit, when you should check if the number of fields is greater than the limit, correct?

       if FieldCount = MAX_SQLFIELDS then
         raise EParsingException.Create ('Too many inlines in TJSONObjectDecoder');

I tested in a table with 64 fields, and when I updated a record, I was getting this error message 'Too many inlines in TJSONObjectDecoder'.

I changed to

       if FieldCount > MAX_SQLFIELDS then
         raise EParsingException.Create ('Too many inlines in TJSONObjectDecoder');

and worked as expected.

What do you think?

PS: If you've already corrected this, ignore it.

tks

#3 Re: mORMot 1 » help! two mvc server, second server that will be a client of the first » 2017-10-06 22:33:45

Sorry if I was not clear. I need the second MVC Server to connect to the first MVC Server database. It is possible?

tks

#4 mORMot 1 » help! two mvc server, second server that will be a client of the first » 2017-10-06 19:35:34

Desenvolvimento
Replies: 2

Hello, I made an MVC Server according to example 30.
I need to create a second server that will be a client of the first server. How do I do that?

First MVC Server - Main

Const
  Root = 'first';

var aModel: TSQLModel;
    aServer: TSQLRestServerDB;
    aApplication: T_Application;
    aHTTPServer: TSQLHttpServer;
begin
  with TSQLLog.Family do
  begin
    Level := LOG_VERBOSE;
    DestinationPath :=   ExeVersion.ProgramFilePath + 'log';
  end;

  try
    //aServer.DB.LockingMode := lmExclusive;
    try

  aModel := CreateModel(Root);

  aServer := TSQLRestServerDB.Create(aModel,ChangeFileExt(ExeVersion.ProgramFileName,'.db'),true);

    aServer.DB.Synchronous := smNormal;

      aServer.CreateMissingTables;
      aApplication := T_Application.Create;

      try
        aApplication.Start(aServer);
        aHTTPServer := TSQLHttpServer.Create('80', [aServer], '+',useHttpApiRegisteringURI,32,secSynShaAes);
        try
          aHTTPServer.RootRedirectToURI(root+'/default');
          aServer.RootRedirectGet := root+'/default';
          // redirect blog to blog/default
          writeln('"MVC First Server" launched on port 80 using ',aHTTPServer.HttpServer.ClassName);
          writeln(#10'You can check http://localhost/'+root+'/mvc-info for information');
          writeln('or point to http://localhost/'+root+' to access the web app.');
          writeln(#10'Press [Enter] to close the server.'#10);
          readln;
        finally
          aHTTPServer.Free;
        end;
      finally
        aApplication.Free;
      end;
    except
      on E: Exception do
      begin
        writeln(E.Message);
        readln;
      end;
    end;
  finally
    aServer.Free;
  end;

How do I connect to the first server database?

Second MVC Server - client of the first

Const
  Root = 'second';

var aModel: TSQLModel;
    aServer: TSQLHttpClientWinHTTP;
    aApplication: T_Application_ADMIN;
    aHTTPServer: TSQLHttpServer;
    db:TSQLRestServerRemoteDB;
    ServerDefinition:TSQLHttpServerDefinition;
begin
  with TSQLLog.Family do
  begin
    Level := LOG_VERBOSE;
    DestinationPath :=   ExeVersion.ProgramFilePath + 'log';
  end;

  try

    try

      aModel := CreateModel('first');

     //TSQLRestServerDB.Create(aModel,ChangeFileExt(ExeVersion.ProgramFileName,'.db'),true);
      aServer :=  TSQLHttpClientWinHTTP.Create('localhost','80',aModel);

      db :=TSQLRestServerRemoteDB.Create(aserver);

      if not aServer.SetUser('User','Pass') then
      begin
        writeln(#10'too bad, invalid login'#10);
        readln;
      end;

      aApplication := T_Application_ADMIN.Create;

      try
        db.Model.Root := root;
         db.RootRedirectGet := root+'/default';
        aApplication.Start(db);

         aHTTPServer := TSQLHttpServer.Create('80', [db], '+',useHttpApiRegisteringURI,32,secSynShaAes);

        try


          writeln('"MVC Second Server" launched on port 80 using ',aHTTPServer.HttpServer.ClassName);
          writeln(#10'You can check http://localhost/'+root+'/mvc-info for information');
          writeln('or point to http://localhost/'+root+' to access the web app.');
          writeln(#10'Press [Enter] to close the server.'#10);
          readln;
        finally
          aHTTPServer.Free;
        end;
      finally
        aApplication.Free;
      end;
    except
      on E: Exception do
      begin
        writeln(E.Message);
        readln;
      end;
    end;
  finally
    aServer.Free;
  end;

So, when I try to run the code below:

   AuthUser_Extend: = TSQLAuthUser_Extend.CreateAndFillPrepareJoined (RestModel,
   'LogonName =? or AuthUser_Extend.Email =? and (AuthUser.ID = AuthUser_Extend.AuthUser) ',
   [],
   [LogonName, LogonName]
   );

raises the "Abstract Error"

...
20171006 19074230 clnt mORMotHttpClient.TSQLHttpClientWinHTTP (025A78A0) GET bigboss? Session_signature = 50AF95DC00067775E49D36ED status = 500 len = 88 state = 0
20171006 19074230 - 00750.030
20171006 19074230 ERROR mORMotHttpClient.TSQLHttpClientWinHTTP (025A78A0) GET bigboss returned 500 (Internal Server Error) with message {"errorCode": 500, "error": {"EAbstractError": {"EAbstractError": "Abstract Error"}}} stack trace API 0056B482 005F223F 005FC7E2 005FD3A1 0061C6CC 005F6C3A 005E9454 007668A8 0063C8D7
20171006 19074230 srvr mORMot.TSQLRestServerRemoteDB (025EC0D0) POST bigboss / Sign_In SOA-Method -> 307 with outlen = 0 in 3657364 us
....

tks,
[]s

#6 mORMot 1 » 30 - MVC - is it possible to check the session when a view is called? » 2017-09-22 13:00:31

Desenvolvimento
Replies: 2

Hello, according to example 30 - MVC ..., is it possible to check the session when a view is called? Example: when calling the "/ root / blog / dashboard" view, if the session does not exist, redirect to "/ root / blog / login".

Tks

Board footer

Powered by FluxBB