0

I am trying to come to a decision on a architecture solution for some new projects that I am building.

These projects need to be multiplatform, mobile, tablet, desktop, etc. So therefore the reason to choose a RESTful api(json) for the backend/server.

I have been working on Java EE for long time, so expirmenting with Spring and Java EE 6 at the moment, but both seem quite straightforward, Spring just seems to have so much more configuration and layers.

I have been looking at Spring 3.1 Rest vs Java EE 6 Resteasy/Jersey.

All have been pretty easy to setup, Spring I used the @EnableWebMvc and the new httpMessageConverters, etc RestEasy/Jersey

It seems in RestEasy/Jersey that the content returned by the web service can be determined by the request (json/xml/html...) Is it the same in Spring?

Any other advice would also be very helpful,

Thanks

2 Answers 2

1

The big advantage of Spring over other frameworks is the possibility to exchange almost all of the default compontents with your own.

In your case the ContentNegotiationViewResolver is probably the one to go. It allows you per default to determine the requested transferable type by the accept header, by the format url parameter or by extension (e.g. .json/.xml)

See the following to get some examples and explanations: http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch18s02.html

Sign up to request clarification or add additional context in comments.

1 Comment

That is not an advantage over Java EE. In Java EE, this can be naturally done without any need to swap any classes. I disagree this is any advantage. It may even be considered a bad design.
0

Yes the returned datatype can be varied in Spring.

You can either use the accept-header of the request or supply a parameter with the request.

See this previous answer.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.