Jump to content

Andrea Magni

Members
  • Content Count

    137
  • Joined

  • Last visited

  • Days Won

    3

Andrea Magni last won the day on November 2 2020

Andrea Magni had the most liked content!

Community Reputation

67 Excellent

4 Followers

About Andrea Magni

  • Birthday 05/24/1982

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

1045 profile views
  1. Andrea Magni

    MARS and Delphi XE5 compatibility

    Hi @Galina, sorry for the late reply. MARS is pretty compatible with older Delphi version up to XE... This is true especially for the server side. The client side has some features relying on the Parallel Programming Library (thus XE7+) but should compile with older version too. Let me know if you encounter issue compiling with older Delphi versions, I will try to help. Sincerely, Andrea
  2. Andrea Magni

    Using an API endpoint as src for img tag ?

    As you can see here: https://github.com/andrea-magni/MARS/blob/f3c2396eeac4df9b1f9a4d4ef640d95bb6dd569d/Source/MARS.Core.MessageBodyWriters.pas#L217 It is a really straightforward implementation and I guess yours is not much different. The StreamToBase64 and StringToStream functions are also available just in case you need them. Let me know if there's anything I can help with! Thanks, Andrea
  3. Andrea Magni

    Using an API endpoint as src for img tag ?

    Hi @Stuart Clennett, you can try using TStream as result type. You can then use a TFileStream (or whatever other TStream descendant). MARS also has specific support to serve base64 encoded images (look for TStreamWriter class implementation). Let me know if you managed to use it. Sincerely, Andrea
  4. Hi @Stuart Clennett, sorry for the late reply! TMARSClientToken component has the capabilities to persist the token (and the related informations) through Load/Save From/To File/Bytes routines. I am considering to introduce also a way to update the component setting a bare JWT token but this would require to compile the JWT library (mORMotJWT or JOSE) on the client side. Let me know your thoughts about it. Sincerely, Andrea
  5. Andrea Magni

    Invoke function in other resource class

    Hi, nice question, sorry for the late of my reply. One thing you can do is to have an inheritance hierarchy. TResourceB may inherit from TResourceA. That way it should be easy to include data from GetSubData in the GetAllData result. You can still keep two distinct resources and MARS will inject everything on this or that class depending on the matching of the request path. Another way would be to pass the Context-Injected instance from one resource to the other. Through an overloaded method for example. Or through a property. I am going to make the injection mechanism more available to direct use in the future. Stay tuned. Sincerely, Andrea
  6. Andrea Magni

    MARSWebServer Service error logging

    Hi Kostas, the MARSWebServer demo has been created way before the InvokeError mechanism has been introduced. The resource takes care to send a 404 response when a URL is not matching a file system entry (no actual error is raised, a custom response is sent). This means it's unlikely you'll ever get to the InvokeError anonymous handler you registered. You have a chance to have it called if you are addressing a non existent resource (different from helloworld). If you will explain me your needs we may improve the demo or build a new one. Sincerely, Andrea
  7. Andrea Magni

    MARSWebServer Compile error

    Hi, sorry for the late. Thanks for pointing it out the demos was not compiling. Some demos are a bit outdated and I need to fix them according latest library changes. I've just pushed an update for this (and some other demos) and it should now work out of the box. More to come. Sincerely, Andrea
  8. Andrea Magni

    MARSWebServer Service config for HTTPS

    Hi, sorry for the late, I've just pushed some new feature about this in MARS. Here's also a blog post about it: https://blog.andreamagni.eu/2021/01/mars-1000th-commit-added-support-to-indy-standalone-ssl/ Beware: I've also refactored many deployment options available to use TMARSHttpServerIndy and less WebBroker stuff. Let me know if you encounter any issue. Sincerely, Andrea
  9. They have some issues with servers ( 🙂 ) ... it should be fixed very soon. The book comes in digital and/or printed edition. The digital options are EPUB, MOBI and PDF. Thanks
  10. Hi all, I just wanted to let you know my (long-awaited) FMX book is now available (actually it is rolling out on Packt and Amazon so availability may be different across different countries). If you like to read some details you can read my latest blog post: https://blog.andreamagni.eu/2020/10/book-delphi-gui-programming-with-firemonkey-now-available/ I really hope the book will be useful to spread Delphi and FMX as development platform. Thanks for the attention, Andrea
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
×