开发者

How a Spring WebApp manages different clients' request?

probably there are a lot of people who will smile reading this question...

Here's my problem. I have a Spring 3 web application acting both as a client and server. It gets some XML data from a client "C", it processes them, and it sends them to a server "S". The input XML fron C must be validated against a schema (e.g. "c.xsd") while the output XML开发者_开发百科 to S must be validated against a different one (e.g. "s.xsd").

I'm using jaxb2 for marshalling and unmarshalling.

In the documentation I read that it is possible to set the "schema" attribute for the [un]/marshaller.

Therefore, I need to have an a.xsd for the validation when I get an input and a b.xsd when I produce an output... the question is the following: when I switch the validation schema from c,xsd to s.xsd (producing an output after processing a request from C), do I change the status of the server? In other words, If I am receiving a second request form a client C2 when I'm processing the first request from C, will I attempt to validate C2 input against s.xsd? Will the application automatically put the C2 request on a different thread? If not, how can I configure spring to do so?

Thanks alot!


I'll take a stab at it:

The input XML fron C must be validated against a schema (e.g. "c.xsd")

You can do this by setting a schema (c.xsd) on the Unmarshaller.

while the output XML to S must be validated against a different one (e.g. "s.xsd").

You can do this by setting a schema (s.xsd) on the Marshaller.

when I switch the validation schema from c,xsd to s.xsd (producing an output after processing a request from C), do I change the status of the server?

No, because the Unmarshaller is always using c.xsd and the Marshaller is always using s.xsd.

Since Marshaller and Unmarshaller are not thread safe you must be sure not to share them among threads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜