Jump to content

Rafael Mattos

Members
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

3 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Attempting to compile the JsonDataObjectApacheModule sample raised the following error: [dcc32 Fatal Error] Server.Resources.pas(19): F2613 Unit 'JsonDataObjects' not found. Has this unit been removed from the last commit?
  2. Rafael Mattos

    HTTPS no MARS

    After a while ... Thanks for the reply @Andrea Magni. I think I'll follow your guidelines.
  3. Rafael Mattos

    HTTPS no MARS

    Hi, does MARS implement the HTTPS protocol?
  4. Rafael Mattos

    CORS.Enabled?

    Hi Jean, Sorry for the delay in reply, but I resolved Andrea's response. Look here: https://github.com/andrea-magni/MARS/blob/master/Demos/MARSTemplate/Server.Ignition.pas // Handle CORS and PreFlight if SameText(ARequest.Method, 'OPTIONS') then begin Handled := True; Result := False; end; I saw that you solved a problem in another post, is it the same?
  5. Rafael Mattos

    CORS.Enabled?

    @Andrea Magni, Thank you very much! I solved the problem with your answer. Moments before I see your answer, I discovered that the browser sends an OPTIONS before every request to know if the server accepts. I in my ignorance had created an OPTIONS method on the server, returning an empty array and with CORS in the header, with the same url for each method (GET, PUT, ...) and had "solved" the problem. I hope this post helps the beginners, as it helped this beginner. Thank you!
  6. Rafael Mattos

    CORS.Enabled?

    Thanks for the reply @Andrea Magni, Maybe this question has nothing to do with the framework, but as it has more experienced professionals here. I ask the question: What is missing? I changed the .ini file as you mentioned, but I still get this error in the browser (Access to fetch at 'http://999.999.999.999:99/rest/propu/agent/Orders' from origin 'http://abcd.com' has been blocked by CORS policy: Response to preflight request does not pass access control check: It does not have HTTP ok status.). I make the same request in postman and I get the answer correctly and in the header I receive (Connection → close Content-Type → application / json Content-Length Date Mon, 15 Apr 2019 11:40:30 GMT Access-Control-Allow-Origin → * Access-Control-Allow-Methods → HEAD, GET, PUT, POST, DELETE, OPTIONS Access-Control-Allow-Headers → X-Requested-With, Content-Type, Authorization) I thank you for your help.
  7. Rafael Mattos

    CORS.Enabled?

    Hello! I am starting to integrate an application that is on the web but the connection to the service is refused. I read something about the CORS mode ... Is correct? FEngine.Parameters.Values['CORS.Enabled']:= True; FEngine.Parameters.Values['CORS.Enabled']:= 'True'; Thank you!
  8. Thank you to everyone who answered me. @Andrea Magni, the framework does what I thought it did not do. I need to free the TJSONArray from memory. Except that in initial tests it seemed to me that the object remained instantiated, but it does not remain. Thank you!
  9. Ok, and where is this caller in the MARS-Curiosity Library?
  10. Hi, how are you? I have a get method with the return of a TJSONArray and that object is not destroyed. And when I destroy at the end of the function and raised an exception. How do I release this object from memory? Thanks in advance. type [Path('product')] TProductResource = class protected [Context] Token: TMARSToken; public [GET, PermiteAll] function GetProduct([FormParam] ClientId: Integer):TJSONArray; end; function TProductResource.GetProduct(ClientId: Integer): TJSONArray; var xJSONArray: TJSONArray; begin try if Token.Roles[0] = 'client' then xJSONArray:= TBllProduct.Singlenton.RetrieveJSONArray(Token.Claims['Id'].AsInteger) else xJSONArray:= TBllProduct.Singlenton.RetrieveJSONArray(ClientId, Token.Claims['Id'].AsInteger); Result:= xJSONArray; finally //FreeAndNil(xJSONArray); end; end;
×