How to Use Content Negotiation in Spring Data Rest?

Efren Narvaez

I am trying to expose my data via Rest Api in difetents formats (xml,json,rdf,jsonld) and I am using Spring-Data-Rest-Framework and I know that it is posible using @RequestMapping in the Controller, buts in Spring Data Rest I only have a entity and a repository that use @RepositoryRestResource notation that does not support @RequestMapping notation.

Can somebody explain me the way to achieve expose my data in difente formats using Spring Data Rest ?

I would like to expecifice the format at the end of the URL like ( ?format=json or ?format=xml)

Shawn Clark

http://docs.spring.io/spring-data/rest/docs/current/reference/html/#representations.mapping

Currently, only JSON representations are supported. Other representation types can be supported in the future by adding an appropriate converter and updating the controller methods with the appropriate content-type.

You would have to build your own converter for XML or other types. As well the standard way to define content type is in the Accept header. If you want to use an override then you need to add a filter to read the query parameter and set the header.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to Use Content Negotiation in Spring Data Rest?

From Dev

How to disable content negotiation for Spring Actuators?

From Dev

How to add csv MimeType to spring content-negotiation?

From Dev

Spring boot controller content negotiation

From Dev

Spring MVC Content Negotiation throwing ClassCastException

From Dev

Is there a simple way to solve content negotiation in Spring boot

From Dev

Why not use content negotiation to return JSON object?

From Dev

spring cloud config-server .properties content-negotiation failing

From Dev

Is there better approach to Accept Header based content negotiation in Spring API?

From Dev

Content negotiation to return HTML

From Dev

PhalconPHP: content negotiation?

From Dev

Restlet Content Type Negotiation

From Dev

Content negotiation using WebSharper

From Dev

PhalconPHP: content negotiation?

From Dev

How to customize Spring Data REST to use a multi-segment path for a repository resource?

From Dev

With Spring Data REST, how to make custom queries use the HATEOAS output format?

From Dev

How to use Firebase with Spring boot REST Application?

From Dev

How to use Firebase with Spring boot REST Application?

From Dev

Spring Data REST - How to handle object ownership

From Dev

How to evolve a Spring Data REST application?

From Dev

How to post a list to Spring Data Rest?

From Dev

How to expose @EmbeddedId converters in Spring Data REST

From Dev

How to add links to Spring Data REST projections?

From Dev

Jersey - content negotiation for error handling

From Dev

How to use Spring Rest Service with REST Component in Mule

From Dev

How to manage REST API versioning with spring data rest?

From Dev

How to call Rest API and use the data in that API?

From Dev

QuickBlox - How to use REST API + PHP to create blob content

From Dev

Spring Data REST example that doesn't use root for mapping

Related Related

  1. 1

    How to Use Content Negotiation in Spring Data Rest?

  2. 2

    How to disable content negotiation for Spring Actuators?

  3. 3

    How to add csv MimeType to spring content-negotiation?

  4. 4

    Spring boot controller content negotiation

  5. 5

    Spring MVC Content Negotiation throwing ClassCastException

  6. 6

    Is there a simple way to solve content negotiation in Spring boot

  7. 7

    Why not use content negotiation to return JSON object?

  8. 8

    spring cloud config-server .properties content-negotiation failing

  9. 9

    Is there better approach to Accept Header based content negotiation in Spring API?

  10. 10

    Content negotiation to return HTML

  11. 11

    PhalconPHP: content negotiation?

  12. 12

    Restlet Content Type Negotiation

  13. 13

    Content negotiation using WebSharper

  14. 14

    PhalconPHP: content negotiation?

  15. 15

    How to customize Spring Data REST to use a multi-segment path for a repository resource?

  16. 16

    With Spring Data REST, how to make custom queries use the HATEOAS output format?

  17. 17

    How to use Firebase with Spring boot REST Application?

  18. 18

    How to use Firebase with Spring boot REST Application?

  19. 19

    Spring Data REST - How to handle object ownership

  20. 20

    How to evolve a Spring Data REST application?

  21. 21

    How to post a list to Spring Data Rest?

  22. 22

    How to expose @EmbeddedId converters in Spring Data REST

  23. 23

    How to add links to Spring Data REST projections?

  24. 24

    Jersey - content negotiation for error handling

  25. 25

    How to use Spring Rest Service with REST Component in Mule

  26. 26

    How to manage REST API versioning with spring data rest?

  27. 27

    How to call Rest API and use the data in that API?

  28. 28

    QuickBlox - How to use REST API + PHP to create blob content

  29. 29

    Spring Data REST example that doesn't use root for mapping

HotTag

Archive