Jump to content

Andrea Magni

  • Content Count

  • Joined

  • Last visited

Community Reputation

47 Excellent


About Andrea Magni

  • Birthday 05/24/1982

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

839 profile views
  1. Embarcadero just release Patch 2 for 10.4 Sydney (https://blog.marcocantu.com/blog/2020-july-radstudio104-patch2.html). Once applied, you won't be able to compile MARS master branch. There is an issue with record constraint on generic calls (https://quality.embarcadero.com/browse/RSP-30078). I've just pushed a (temporary) branch of MARS where all the record constraints have been removed (thus it compiles and it seems to work as expected for what I can say at the moment). You can find it here: https://github.com/andrea-magni/MARS/tree/104Patch2 Sincerely, Andrea
  2. Andrea Magni

    Setting Up in ISAPI

    Sorry for the late @RussellW, sometimes it is hard for me to reply immediately! Glad you sorted it out! Sincerely, Andrea
  3. Andrea Magni

    MARS and JWT cookie authentication

    Hi @Alfredo I., thanks for using MARS! Please have a look at the Authorization demo. Just compile and run the server and open a browser at http://localhost:8080/rest/default/token/html You should see a simple HTML page allowing you to login/logout. The mechanism is cookie-based and it really seems your same situation. Please let me know if you find out what's not working in your case. Sincerely, Andrea
  4. Andrea Magni

    Heading params list

    I've added a hack (accessing a protected field of TIdHTTPAppRequest casting a reference to TWebRequest to a subclass) that seems (and should reasonably) work. The hack only relates to those deployment methods where Indy is not letting me access the TWebRequestInfo data structure (Apache modules, IIS ISAPI, Windows Service). From now on, you can use the GetHeaderParamCount, GetHeaderParamValue, GetHeaderParamIndex methods of IMARSRequest interface. uses MARS.Core.RequestAndResponse.Interfaces; // in your resource definition or as a method argument [Context] FReq: IMARSRequest; Let me know if this is enough. Feel free to reopen issue #95 if needed. Sincerely, Andrea
  5. Andrea Magni

    Heading params list

    Hi @Claudio Villaschi, sorry for the late. There are some limitations with Indy and enumerating request headers. I am trying to improve the current support as much as possible. Follow this: https://github.com/andrea-magni/MARS/issues/95 Sincerely, Andrea
  6. Hi @bioman, thanks for pointing out compilation broke. I just fixed it: https://github.com/andrea-magni/MARS/issues/94 About the encoding, MARS is a layer of abstraction over the transport protocol (http). You implement your method (I guess) returning a Delphi string value. MARS serializes (where needed) the values to a stream that will be used as the response of the request. Then, it's the underlying http library (MARS supports Indy, WebBroker over Apache module and IIS ISAPI and, more recently, Delphi Cross Socket framework) that sends the content to the client. Indy has this trend of setting Content-Type=text/html; charset=ISO-8859-1 as default so sometimes you get it (when using Indy/WebBroker as http layer for MARS). MARS (and Indy neither) can't easily say if your string is a UTF8 or MBCS or ANSI string, but you should know for sure. So, if you are sending an UTF8 content in your string, mark your resource/method with an Encoding attribute stating so. [GET, Path('geoconding.html'), Encoding('UTF-8')] function MyContentGenerator: string; Let me know if you solve this way! Sincerely, Andrea
  7. Andrea Magni

    MARS & Delphi 10.2

    Thanks, I am using a portion of mORMot (check my mORMotJWT repository: https://github.com/andrea-magni/mORMot-JWT) I have extracted (with permission) in order to benefit of their JWT implementation (that is way better than the JOSE implementation). Unfortunately, they are (were?) not supporting Linux compilation with Delphi because of ARC. That's the reason I still have JOSE and mORMotJWT support at the same time. Glad you solved! Sincerely, Andrea
  8. Hi @NilsSchneider, would you please post here the resource definition? If I got it correctly you registered three different resource classes for the same path (systems). Sincerely, Andrea
  9. @bioman, hi, thanks for the kind words about MARS! Would you please paste here the prototype of your method? What data type the result is? Sincerely, Andrea
  10. We are fine thanks! Getting used to the "new normal" and looking ahead hoping things will globally improve soon. I've merged your PR a couple of minutes ago, thanks! 🙂 Andrea
  11. Hi @Stuart Clennett, my fault! I forgot to update some prototypes here and there. Thanks for pointing this out: add these to the uses clause: , MARS.Core.URL, MARS.Core.RequestAndResponse.Interfaces change the BeforeHandleRequest assignment to : FEngine.BeforeHandleRequest := function (const AEngine: TMARSEngine; const AURL: TMARSURL; const ARequest: IMARSRequest; const AResponse: IMARSResponse; var Handled: Boolean ): Boolean begin Thanks! I'll fixit in the repo ASAP Andrea
  12. Right, thanks @ertank! In the Source/MARS.inc file there is a specific define to state FireDAC support is included or not: https://github.com/andrea-magni/MARS/blob/edb3c7e7a43dbac2f94f124b08107a6c3f4b5074/Source/MARS.inc#L1 Sincerely, Andrea
  13. Just in case you missed: a new version of MARS-Curiosity REST library has been released yesterday. https://github.com/andrea-magni/MARS/releases/tag/v1.4 V.1.4 adds support for Delphi 10.4 Sydney as long as many other features and functionalities to the library. I will cover most important new features with some blog posts in the following weeks. Sincerely, Andrea
  14. Andrea Magni

    Injection Respose

    Hi Marzio, TMARSResponse is intended to be used as return type of your REST methods. If you are looking for a reference to the response object (implemented by the http layer) the second writing is correct. Soon, I'll release a new MARS version and there will be an IMARSResponse interface, wrapping the underlying object (MARS will be soon able to abstract from the http layer, in order to allow use of DelphiCrossSockect along side of Indy and other libraries). Sincerely, Andrea
  15. Glad you solved, sorry being away so much 😉