#1 2019-10-31 03:44:16

keinn
Member
Registered: 2014-10-20
Posts: 100

MVC of the framework design is a little Imperfect

Thanks ab for the great mORMot framework, it helps me a lot.

i use the framework SOA、ORM  a lot .

now i need to build a web site. i guess at somepoint , we all need a website.

i found a little imperfect of MVC:

when you just need to show some pages,
just write you view template and define some interface , it works fine, same as Sample 30--MVC Server.

but, when you need to use Ajax in pages to Post data to or Get data from  the mvc server, it CAN NOT be done.

i mean , when you need to do AJAX request from the MVC application, there the NO WAY to return json data from the mvc application(interface)

i know,i know ,  u can make AJAX request to the RestServer (not to the mvc application),

but this approach will need to deal with the rest auth, while MVC application is based on Cookie.

for example:
when user need to login to the Web(not the RestSerrver), since our MVC application can not return custom json format (which ajax need),
we loose the ablity to interact with user  before or after the login.

or  , some page need use Ajax request data only after user login (again, web cookie, not the restserver auth)

so, if mvc application return JSON data will solve all that .(not the methodname/json approach, it is still for view context)

Offline

#2 2019-10-31 07:43:12

pvn0
Member
From: Slovenia
Registered: 2018-02-12
Posts: 210

Re: MVC of the framework design is a little Imperfect

keinn wrote:

i know,i know ,  u can make AJAX request to the RestServer (not to the mvc application),

but this approach will need to deal with the rest auth, while MVC application is based on Cookie.

You don't need to deal with rest auth, you can disable/ignore it and deal with cookies directly.

Offline

#3 2019-10-31 08:34:52

keinn
Member
Registered: 2014-10-20
Posts: 100

Re: MVC of the framework design is a little Imperfect

pvn0 wrote:
keinn wrote:

i know,i know ,  u can make AJAX request to the RestServer (not to the mvc application),

but this approach will need to deal with the rest auth, while MVC application is based on Cookie.

You don't need to deal with rest auth, you can disable/ignore it and deal with cookies directly.

you mean process Cookie head(Read/Write) in the Ctxt Context within the method based service or in the ServiceContext within the interface based service?

this can do it , and i know it , reason i post this thread is hope mORMot MVC will be more powerful and do not rely on other parts of the framework:

lets say :

mORMotMVC is more suitable to deal with cookie\Session ,while Rest Service is not so direct . and also , it is not in the MVC subRoot

again within the mORMotMVC , if we can use the Service ability directly(do not need view) in the TMVCApplication , it will be perfect

for now ,  mORMot MVC have some problem :
1、the methodname/json/ can return json data , but it can NOT take param(like json format) send by POST ,just GET work for now
2、every TMVCApplication view method need a view template, while some processing like :login/logout just need process params(by get/post) , they do NOT need view template

Offline

#4 2019-11-01 07:05:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: MVC of the framework design is a little Imperfect

I would not use MVC as SOA only.
The /json trick may be good for a few SOA endpoints, but not has a full SOA replacement.

Perhaps if binary cookies are moved to mORMot, then it would be more convenient for cookie-based SOA.

Adding explicit SOA features to mORMotMVC (like cookies or POST support) will make redundand code for sure, and break the design: where do we stop? cookies? threading? XML marshalling?
mORMot SOA has a lot of features, and will always be more complete then mORMotMVC for service definition.

Offline

Board footer

Powered by FluxBB