Rafael Mattos
Members-
Content Count
10 -
Joined
-
Last visited
Community Reputation
3 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
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?
-
After a while ... Thanks for the reply @Andrea Magni. I think I'll follow your guidelines.
-
Hi, does MARS implement the HTTPS protocol?
-
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?
-
@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!
-
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.
-
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!
-
How to release a return [TJSONArray] object from a get method?
Rafael Mattos replied to Rafael Mattos's topic in MARS-Curiosity REST Library
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! -
How to release a return [TJSONArray] object from a get method?
Rafael Mattos replied to Rafael Mattos's topic in MARS-Curiosity REST Library
Ok, and where is this caller in the MARS-Curiosity Library? -
How to release a return [TJSONArray] object from a get method?
Rafael Mattos posted a topic in MARS-Curiosity REST Library
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;