On Jan 24, 5:02 am, Cristian Olaru <
col...@gmail.com> wrote:
> Hi Richard.
>
> In fact business exceptions (I use a bad name) that are part of the services
> signatures (I prefer to throw business exception on this level instead
> returnig null's). Are not runtime exceptions - you will catch them in
> presentation - are part of our services contract.
Actually, the service and business exceptions should propagate up to
the "resource" layer, where a proper HTTP_STATUS_CODE will be included
in the response. The presentation layer know only about which URI to
use to invoke a particular service.
for example, the client would do something like this (for a
registration)
Client request:
PUT /user HTTP1.1
Host:
https://classic.com/
User-Agent:
Content-Type: text/json; charset=utf-8
Content-Length: 9090
...
<!-- json serialisation of user data-->
[ {
"username": "
joe...@gmail.com"
"password": "hash(password)"
"address": "...."
....ect......
}]
server dispatches to the appropriate handler, extract headers in
necessary, de-serialize json message body and processes it. If
successful server returns :
Server response
HTTP/1.1 201 created
Location:
http://classic.com/user/userid
Date: ...
Last-Modified:
...other data is needed here....ect....
This approach allow to expose the service to other type of clients
(i.e not browsers based).
>
> Because the interface (presentation) is driven by you, for me the entry
> point for me are the services (in fact you decide from presentation what
> services you need to be implemented). So the services layer will do what you
> want - the user stories will have a reflection in interface (WS) and not
> directly in the services layer.
The user stories are reflected in the resources they represent. For
example, we have a user resource for a the UserService class,
ect...Look at the resources folder, you should see some definitions of
the resources service. This layer is the entry point. All of these
services and resources are stateless, from end-to-end. Client is
responsible for its own internal state.
This design allows for easier vertical (adding services) and
horizontal (adding more machines) scaling if needed.
When we will clustering, I plan to use a session hashing and store it
in the DB for "load balancing" and moving the actual design to SEDA
style architecture. But will probably happen much later.
>
> So, at this layer we must collaborate for details. Now I can implement and
> test as I fell.
We could a skype video call or a google chat if you like. Let me know
if you need that and when is it a good time for you.