开发者

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

开发者 https://www.devze.com 2022-12-21 01:02 出处:网络
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?

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

精彩评论

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

关注公众号