首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安排服务器组件鸭

安排服务器组件鸭
EN

Stack Overflow用户
提问于 2009-11-17 02:51:27
回答 1查看 33关注 0票数 0

我正在努力寻找一个优雅的框架来安排我的所有服务器组件。

服务器:

代码语言:javascript
复制
1. Receives a request, as a XML string, from the client.

2. Validates the messages ( !null && !empty mainly).

3. Unmarshalls the message into a Request object.

4. Validates the internals of the Request object (ensures all the required fields are there, ie. id, requestName etc).

5. If valid, create a specific request (I receive a lot of extra information in the original request and I need a very small subset of it to process the request).

6. Process the request and retrieve the output.

7. Send the output to the client.

目前,我的设计如下所示:

代码语言:javascript
复制
Controller{

processMessage(String requestMsg){
boolean isValid = validator.validate(requestMsg);
Request request = creator.createRequest(requestMsg);
isValid = validator.validate(request);
processor.processRequest();

}

控制器类由验证器、创建者和处理器组成。一旦接收到请求,就会遵循验证-创建过程的模板。

现在所有这些都起作用了,但我不禁想知道我是否能以更好的方式安排这些组件。最好是松耦合。

是否有一个我可以使用的框架?任何想法,提示,链接都是非常有帮助的。

干杯

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-11-17 03:01:55

看看春天。它有一个绑定和验证API,web控制器,一个基于POJO接口的定义良好的服务层。

即使不使用框架,这也是良好Java设计的一个很好的例子。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1746286

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档