GWT - What to add to the shared folder?

I'm still not sure what to add to the shared folder. If I execute RPC requests and send Pojos from client to server and vice versa, I have to put them in the shared folder (because they are used by both the client and the server).

EDIT

I may have used the wrong term, but when I said Pojo , I meant DTO .

+4
source share
2 answers

You do not need to put POJO RPC in the shared folder, but if you store them in the client folder, the server will depend on the client package, because Pojos are used by both the client and the server. This is definitely better if the client and server are strictly separated and that for the shared folder.

The shared folder includes me:

  • RPC Requests / Answers - I am using the command template (gwt-dispatch)
  • Data Transfer Objects (DTO) - Lightweight objects used for data transfer
  • Input validators - the logic that is used when checking on the client side and on the server side
  • General configuration
+3
source

The shared folder should contain only code that should be shared between the client and server. Keep in mind that this code must be executable by the client, so you do not have access to some Java classes.

Thus, any POJO or DTO class must be in a shared folder.

+2
source

Source: https://habr.com/ru/post/1348110/


All Articles