GWT - 在共享文件夹中放什么? [英] GWT - What to put in the shared folder?

查看:17
本文介绍了GWT - 在共享文件夹中放什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然不确定将什么放入 shared 文件夹.如果我正在执行 RPC 请求,并将 Pojo 从客户端发送到服务器,反之亦然,我是否必须将它们放入 shared 文件夹中(因为它们被客户端和服务器同时使用).

I'm still unsure on what to put into the shared folder. If I'm doing RPC requests, and sending Pojos from the client to the server and vice versa, do I have to put them into the shared folder (because they are used by both - client and server).

编辑

也许我用错了术语,但当我说 Pojo 时,我的意思实际上是 DTO.

Maybe I've used the wrong term but when I said Pojo I actually meant DTO.

推荐答案

您不必将 RPC POJO 放在 shared 文件夹中,但如果将它们保存在 client 文件夹,服务器将依赖于客户端包,因为客户端和服务器都使用 Pojo.将客户端和服务器严格分开肯定更好,这就是 shared 文件夹的用途.

You don't have to put the RPC POJOs in a shared folder but if you keep them in the client folder, the server would be dependent on the client package because the Pojos are used both by the client and the server. It's definitely better to have client and server strictly separated, and that's what the shared folder is for.

我将放入 shared 文件夹的内容是:

The stuff I would put into the shared folder is:

  • RPC 请求/响应 - 我使用的是命令模式 (gwt-dispatch)
  • 数据传输对象 (DTO) - 用于传输数据的轻量级对象
  • 输入验证器 - 在客户端和服务器端验证期间共享的逻辑
  • 共享配置

这篇关于GWT - 在共享文件夹中放什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆