MyEclipse for Spring
Code Reference: GwtCustomerServiceImpl.java
The remote service implementation that connects the GWT client to the Spring service layer.
GwtCustomerServiceImpl is the server side of the GWT remote service. It receives a transfer type, converts it to an entity, calls the Spring service and converts the result back. The class is a thin bridge, not a place for business rules.
Methods
- list. Returns every customer as a transfer type, ordered by name.
- get. Returns one customer by key, or null when no record exists.
- save. Converts the transfer type, calls the service and returns the saved result.
- remove. Deletes by key and returns a boolean result.
Error handling
Translate service exceptions into a small set of remote exceptions that the client understands. Do not send stack traces to the browser. Log the detail on the server and return a short message that the client can show next to the form.
One bridge per aggregate. Keep the remote service focused on one type. A single remote service that handles every screen becomes a bottleneck and a security risk.
The class is generated. Add new remote operations in the model and regenerate. Hand written remote services belong in a separate package and are not overwritten.