4

Our RESTful application need to support 'partial responses' to limit bandwith. By this I mean that the REST client tells the URI service which fields of the resource it is interested in.

For instance: api/v1/users/123/fields=firstName,lastName,birthDate

We're using Jackson parser to convert our DTO's to a JSON structure. The problem is that we cannot tell at runtime to 'skip' some properties. We should need to create a class at runtime with a variable amount of properties to accomplish this. But I don't think this is possible in Java, it is a static language after all.

While searching the internet we found some semi-solutions by just returning a java.util.Map containing the requested properties or filtering out properties by the Jackson parser. Especially the latter seems a 'hacking solution' to me. It seems that Spring MVC doesn't provide an out-of-the-box solution for this issue...

Is there any alternative in the Java world we can use to solve this issue?

user2054927
  • 969
  • 1
  • 12
  • 30

1 Answers1

2

How about Yoga

Yoga extends JAX-RS and SpringMVC RESTful servers to provide GData and LinkedIn style field selectors.

  • Choose which fields you want to see at call-time
  • Navigate entity relationships in a single call for complex views
  • Much faster speeds in high-latency (e.g. mobile) apps
  • Streamline client development
  • Browsable APIs
Community
  • 1
  • 1
theon
  • 14,170
  • 5
  • 51
  • 74