سؤال

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