Grails Content Negotiation - handling unsupported type
We are using content negotiation in our service using the Accept header and the withFo开发者_如何转开发rmat method....the issue we are facing is that we want to return a 406 http status if the Accept header has a type which is not supported by our service....can anybody give us some ideas on how would we go about doing this?
return withFormat {
html {
render(view: "itWorked", model: data)
}
json {
render(data as JSON)
}
xml {
render(data as XML)
}
}
render(status: 406, text: 'ERROR')
精彩评论