Jump to content

Bjørn Larsen

Members
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Bjørn Larsen

  • Birthday 12/27/1979

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

2037 profile views
  1. Hi, I have a MARS server with multiple resource-classes. In one of these classes I would like to insert data that is provided from a method on another resource class. Example: TResourceA = class [GET] function GetSubData: String; end; TResourceB = class [GET] function GetAllData: String; end; When ResourceB.GetAllData is invoked I would like to include data from ResourceA.GetSubData in the response. This works fine by creating an object of TResouceA and call GetSubData long as ResourceA does not use objects injected through attributes. (E.g [Context] FD: TMARSFireDAC); What is the correct way to do this when ResourceA uses attributes ([Context] FD: TMARSFireDAC)? Best regards, Bjørn Larsen
  2. Bjørn Larsen

    GZip compression in MARS

    I totally agree with your input. In my case the api is going to be distributed to x number of local sites, where there will be no Apache/IIS. A simple setup is the key, and compression as part of executable is a big benefit. I have created a pull request for the changes to MARS.Core.Utils and the implementation in MARSTemplate demo.
  3. Hi, For those intereste;, I have implemented gzip compression in MARS. https://github.com/larsenbjorn/MARS/commit/57d52646ee34f91e6d0b1791ea7c7ff28da803b2 I have not done any real benchmarks on this, but based on simple time measuring, the gain by enabling compression increases with slower connection and larger amounts of data (naturally) and in mobile apps. The impact/gain is not noticeable when everything is running on the same computer. @Andrea Magni Do you see any problem with the implementation? If you find the solution usable I am happy to create a pull request. Best regards, Bjørn Larsen
  4. Hi Andrea, I have to start documenting my API's and have looked into a simple solution using Swagger UI. Based on the Mustache demo I got it working. (https://petstore.swagger.io/ and specifying the local swagger endpoint from the demo). (I created a fork and a pull request with the changes I had to do as I think this might be useful for other than me. https://github.com/andrea-magni/MARS/pull/70/files) I am not able to get the attribute MetaVisible working. I suppose this is an attribute to hide endpoints from the documentation, or am I wrong? One other thing that I think would have been nice; is an attribute for specifying the Response.StatusCode for an successful request. For instance: a POST request often has StatusCode 201, while DELETE has 204, etc. Maybe this attribute could be used in the Metadata classes as well, and end up in the swagger documentation? Best regards, Bjørn
  5. Bjørn Larsen

    Custom media type

    Hi @Andrea Magni, Thanks for another great solution. I went with your solution for defining a new media type. This way I can mix the returning media types without a lot of clutter. Most of the methods returns records, so I just "faked" a new writer this way 🙂 [Produces(MEDIATYPE_APPLICATION_SCIM_PLUS_JSON)] TScimRecordWriter = class(TRecordWriter); At first I could not get it to work, but finally I figured out that I had to registered the writers in the correct order. Otherwise the first writer would always be triggered. Best regards, Bjørn
  6. Bjørn Larsen

    Custom media type

    Hi, I need to implement RFC 7643 (System for Cross-domain Identity Management) where the content-type must be "application/scim+json". Is it possible and how do I add this as a new media type? I have tried [GET, Path('users/{UserID}'), Produces('application/scim+json')] but this results in loosing all quoting of names and values in the JSON result. I am able to archive the desired result by using TMediaType.APPLICATION_JSON and manipulate the TWebResponse directly, but then I need to also set content-encoding. Doesn't seems like a smooth solution. Is this the best way to solve this? Best regards, Bjørn
  7. Bjørn Larsen

    How to add FireDAC Datamodule as per the demo?

    Hi, Have you made sure that your unit is listed under uses and included in the filter that is specified in the AddApplication procedure? FEngine.AddApplication('DefaultApp', '/default', [ 'Server.*']); -- Bjørn
  8. Bjørn Larsen

    Master switch for use of tokens

    Hi Andrea, Thank you for quick feedback and a perfect solution! Always nice to get first class feedback from the author 🙂 Best regards, Bjørn
  9. Hi, I need to implement a solution where the administrator must be able to specify if the apis requires use of tokens or if its publicly available. Can someone give me a hint on how to solve this with MARS? Is it possible to specify different attribues depending on a setting? Or how to solve this? Best regards Bjørn
  10. Bjørn Larsen

    Microsoft Team Foundation System and Delphi

    We are using Delphi, SourceTree and TFS (git repos and the web frontend). The TFS web frontend has improved a lot. It's a flexible and stable combination that works very well. We have a full CI/CD setup where the Delphi packages are handled using a ProGet server for the build process.
×