Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 安排服务器组件_Java_Oop - Fatal编程技术网

Java 安排服务器组件

Java 安排服务器组件,java,oop,Java,Oop,我试图找到一个优雅的框架来安排我所有的服务器组件 服务器: 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

我试图找到一个优雅的框架来安排我所有的服务器组件

服务器:

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();

}
控制器类由验证器、创建者和处理器组成。 一旦收到请求,将遵循validate-create-process模板

现在所有这些都可以工作了,但我不禁想知道我是否可以更好地安排这些组件。最好是松散耦合

是否有一个我可以使用的框架?任何想法、技巧和链接都会非常有用

干杯

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


即使您不使用该框架,它也是优秀Java设计的一个很好的例子。

谢谢duffymo,我已经开始研究它了。