我正在努力寻找一个优雅的框架来安排我的所有服务器组件。
服务器:
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.目前,我的设计如下所示:
Controller{
processMessage(String requestMsg){
boolean isValid = validator.validate(requestMsg);
Request request = creator.createRequest(requestMsg);
isValid = validator.validate(request);
processor.processRequest();
}控制器类由验证器、创建者和处理器组成。一旦接收到请求,就会遵循验证-创建过程的模板。
现在所有这些都起作用了,但我不禁想知道我是否能以更好的方式安排这些组件。最好是松耦合。
是否有一个我可以使用的框架?任何想法,提示,链接都是非常有帮助的。
干杯
发布于 2009-11-17 03:01:55
看看春天。它有一个绑定和验证API,web控制器,一个基于POJO接口的定义良好的服务层。
即使不使用框架,这也是良好Java设计的一个很好的例子。
https://stackoverflow.com/questions/1746286
复制相似问题