문제

Currently i use a custom json marshaller to render a response, like illustrated in this article.

In this article they use one custom marshaller for each Domain Class. For example: /books and /books/1 will give the same data representation.

What i want is a different rendering for those two. So that /books gives less detailed information than /books/1.

Does anyone know to chose a marshaller or alter the response based on the request that has been made?

도움이 되었습니까?

해결책

According to the Grails documentation you can register named marshallers. This way you can decide in your controller which marshaller to use. The documentation has some good examples of this as well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top