You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Ean Schuessler <ea...@brainfood.com> on 2014/04/03 22:36:09 UTC
Separation of concerns in the ControlServlet
In our internal development we have been working to keep our app
logic inside services and not let it leak out into the web action
code. In general, we're basically working to eliminate the use of
code in the actions and move it all the way out to client side
javascript. By the time the client talks to OFBiz in our current
work it is typically the direct invocation of a service.
One challenge we have noticed is dealing with cookies and session
attributes. We are thinking that it is an oversight that the
Controller allows a service to read from parameters and session
values but does not allow it to write back to them. If the mode
is OUT and the session-attribute-name value is set then the
outbound value should be written to the session. If this was
expanded to allow cookie and localStorage values then most
interactions could be reduced entirely to service invocations.
We talked about opening a bug for this but thought that it might
make sense to discuss it and clarify the idea with a little group
discussion.
There are some additional changes we would like to see for adding
the HTTP method as part of the binding for service invocations.
For instance:
/profile + GET = read a profile
/profile + PUT = create new profile
/profile + POST = update a profile
/profile + DELETE = delete a profile
... etc...
This would allow better support of RESTful client side
technologies like Backbone.js.
--
Ean Schuessler, CTO
ean@brainfood.com
214-720-0700 x 315
Brainfood, Inc.
http://www.brainfood.com
Re: Separation of concerns in the ControlServlet
Posted by ad...@sandglass-software.com.
Personally, I try to avoid putting things in the session because it
causes quirky behavior. If you want to move to RESTful services, then
the application state should remain in the representation (Fielding).
More on OFBiz and REST:
https://issues.apache.org/jira/browse/OFBIZ-4274
-Adrian
Quoting Ean Schuessler <ea...@brainfood.com>:
> In our internal development we have been working to keep our app
> logic inside services and not let it leak out into the web action
> code. In general, we're basically working to eliminate the use of
> code in the actions and move it all the way out to client side
> javascript. By the time the client talks to OFBiz in our current
> work it is typically the direct invocation of a service.
>
> One challenge we have noticed is dealing with cookies and session
> attributes. We are thinking that it is an oversight that the
> Controller allows a service to read from parameters and session
> values but does not allow it to write back to them. If the mode
> is OUT and the session-attribute-name value is set then the
> outbound value should be written to the session. If this was
> expanded to allow cookie and localStorage values then most
> interactions could be reduced entirely to service invocations.
>
> We talked about opening a bug for this but thought that it might
> make sense to discuss it and clarify the idea with a little group
> discussion.
>
> There are some additional changes we would like to see for adding
> the HTTP method as part of the binding for service invocations.
> For instance:
>
> /profile + GET = read a profile
> /profile + PUT = create new profile
> /profile + POST = update a profile
> /profile + DELETE = delete a profile
> ... etc...
>
> This would allow better support of RESTful client side
> technologies like Backbone.js.
>
> --
> Ean Schuessler, CTO
> ean@brainfood.com
> 214-720-0700 x 315
> Brainfood, Inc.
> http://www.brainfood.com
>