Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-13203

HttpMessageConverter based on Protostuff library



    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Do
    • Affects Version/s: 4.1.7
    • Fix Version/s: None
    • Component/s: Web
    • Labels:
    • Last commented by a User:


      We have a large application with an API layer on top. Current customers invoke the API using JSON or XML data packets. A few potential customers have asked us to add support for Google Protocol Buffers and BSON as well.

      Since our @RestController s already exchange JSON and XML data using regular POJOs, we want to explore whether we can add Profobuf and BSON using the same POJOs. When we looked at existing Protobuf support in Spring WebMVC, we could see the ProtobufHttpMessageConverter class. However, this class only works with POJOs generated using protoc and hence does not work for our existing set up.

      After searching around, we found the Protostuff library that can generate Protobuf messages with POJOs. We therefore created an HttpMessageConverter using Protostuff. As a bonus, we got BSON support through a format called smile that is also supported by Protostuff.

      I would imagine that it would be a common need for other projects to integrate Protobuf support in an existing API layer. Would there be interest in adding Protostuff support to Spring WebMVC? If yes, I can contribute code to the project along with its necessary tests. I have attached our current message converter with this ticket for review and comments. If this is acceptable, I will submit a pull request on Github.


          Issue Links



              bclozel Brian Clozel
              manish.in.java Manish
              Last updater:
              Spring Issues Spring Issues
              7 Vote for this issue
              11 Start watching this issue


                Days since last comment:
                3 years, 37 weeks, 1 day ago