delphimvcframework icon indicating copy to clipboard operation
delphimvcframework copied to clipboard

How do I access the "root" path?

Open Margera opened this issue 1 year ago • 3 comments
trafficstars

I'm creating a controller with some information and redirections that are as "root". However, the DMVC response is always 404.

Sample:


[MVCPath('/')]
  TAboutController = class(TMVCController)
  public
    [MVCPath('/')]
    [MVCHTTPMethod([httpGET])]
    procedure Redirect;

      // OR

    [MVCPath]
    [MVCHTTPMethod([httpGET])]
    procedure Redirect;

    [MVCPath('/about')]
    [MVCHTTPMethod([httpGET])]
    procedure AboutAPI;
end;

In short, this access doesn't work "http://localhost:52146/", this one also doesn't work "http://localhost:52146/about"

I noticed that there are some examples implemented this way, but they don't work either. So how can I do this?

Margera avatar Jul 12 '24 19:07 Margera

Which samples don't work?

Il Ven 12 Lug 2024, 21:33 Bruno Silva @.***> ha scritto:

I'm creating a controller with some information and redirections that are as "root". However, the DMVC response is always 404.

Sample:

` [MVCPath('/')] TAboutController = class(TMVCController) public [MVCPath('/')] [MVCHTTPMethod([httpGET])] procedure Redirect;

// OR

[MVCPath] [MVCHTTPMethod([httpGET])] procedure Redirect;

[MVCPath('/about')] [MVCHTTPMethod([httpGET])] procedure AboutAPI;

end; ` In short, this access doesn't work "http://localhost:52146/", this one also doesn't work "http://localhost:52146/about"

I noticed that there are some examples implemented this way, but they don't work either. So how can I do this?

— Reply to this email directly, view it on GitHub https://github.com/danieleteti/delphimvcframework/issues/760, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK4ZJCRHL66ZX4YXOJHAOTZMAVPVAVCNFSM6AAAAABKZPB2TOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYDMMRRGUZTINY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

danieleteti avatar Jul 12 '24 21:07 danieleteti

the project "..\samples\authenticationauthorization" is an example, in this project we have the controller AppControllerU with the "procedure TApp1MainController.Index" which is a direct call to a "root" (http://localhost:8080/).

In this situation, the return is "NotFound" image

Another example project is "..\samples\custom_exception_handling" which has the procedure TMyController.Index; as "root".

It's important to mention that I'm using version 3.2.2(nitrogen) with Delphi 10.1

Margera avatar Jul 15 '24 12:07 Margera

Both examples (the first one is no more contained in the project, howver I tested basic_demo_server which does almost the same thing) work in 3.4.2-magnesium-rc2. Can you create a very simple self-contained test which reproduce the problem? We have to understand if it is a Delphi 10.1 issue or a dmvcframework-3.2.2-nitrogen issue.

danieleteti avatar Jul 19 '24 16:07 danieleteti

Unfortunately, the newer versions of DMVC do not work in Delphi 10.1. It is incompatible.

I recently tested DMVC version 3.4.1.

For example:

  • In MVCFramework.Cache, in TMVCCache.RemoveItem. the IsObjectInstance does not exist in the call lItem.Value.IsObjectInstance. Because the System.Rtti TValue does not have this property in Delphi 10.1

  • In MVCFramework.ActiveRecord, in TMVCTableMapRepository.AddTableMap the TObjectDictionary cannot resolve the TryAdd function, because it does not exist.

-It is also possible to see that there is a var declaration that is in a position that is not accepted by Delphi 10.1

Captura de tela 2024-12-06 110822 Captura de tela 2024-12-06 110355 Captura de tela 2024-12-06 135525

Margera avatar Dec 06 '24 14:12 Margera

We'll check ASAP.

Thanks

DT

Il Ven 6 Dic 2024, 15:11 Bruno Silva @.***> ha scritto:

Unfortunately, the newer versions of DMVC do not work in Delphi 10.1. It is incompatible.

I recently tested DMVC version 3.4.1.

For example:

In MVCFramework.Cache, in TMVCCache.RemoveItem. the IsObjectInstance does not exist in the call lItem.Value.IsObjectInstance. Because the System.Rtti TValue does not have this property in Delphi 10.1

In MVCFramework.ActiveRecord, in TMVCTableMapRepository.AddTableMap the TObjectDictionary cannot resolve the TryAdd function, because it does not exist.

Captura.de.tela.2024-12-06.110822.png (view on web) https://github.com/user-attachments/assets/62256431-395b-44aa-8ed5-c2ed0bbe245e Captura.de.tela.2024-12-06.110355.png (view on web) https://github.com/user-attachments/assets/26655a18-3c69-43d9-932e-838d63eced91

— Reply to this email directly, view it on GitHub https://github.com/danieleteti/delphimvcframework/issues/760#issuecomment-2523335258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK4ZJG4NJ2PBWMKQWM2W3L2EGWAJAVCNFSM6AAAAABKZPB2TOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTGMZTKMRVHA . You are receiving this because you were assigned.Message ID: @.***>

danieleteti avatar Dec 06 '24 18:12 danieleteti

Any news on this? Do the new version solve the issue?

danieleteti avatar Jun 03 '25 14:06 danieleteti

I downloaded the main sources and tested them. Apparently now there was only a problem in the MVCFramework.Nullables unit with the Float32 and Float64 types, I looked for this in System.Type and System.Math, but it seems that this does not exist in this version of Delphi.

Image

Margera avatar Jun 04 '25 11:06 Margera

I downloaded the main sources and tested them. Apparently now there was only a problem in the MVCFramework.Nullables unit with the Float32 and Float64 types, I looked for this in System.Type and System.Math, but it seems that this does not exist in this version of Delphi.

This in another issue and has been fixed in the referenced commit.

danieleteti avatar Jun 04 '25 15:06 danieleteti

Let me know if all is OK now.

danieleteti avatar Jun 04 '25 15:06 danieleteti

There was a problem comparing the objects

Image

Margera avatar Jun 04 '25 17:06 Margera