开发者

Advice on SOA to drive spring mvc pages, and service iphone/android requests also

If I have a web application that also services requests for iphone/android appl开发者_Python百科ications, what is the best way to go about designing the application?

i am using spring mvc.

Would it be possible (or advisable) to use the same controller action to service both web and mobile requests, or would I have to duplicate things with another set of controllers?


You certainly can use SpringMVC's REST feautures and content negotiation. Or you can write an interceptor for your controllers that can analyze request type, or use any other information that can be obtained from HTTP Request Headers, and use appropriate view (JacksonJsonView, XmlMarshallingView or JstlView depending on the requester type)

As another approach you can use some JAX-RS implementation near your spring mvc to make your services. here's a nice article on integrating spring mvc and resteasy (jboss's jax-rs impl) - http://java.dzone.com/articles/resteasy-spring

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜