Thanks all for your help. Finally I was able to solve this puzzle. Here is the code that fixed by problem:
class ImageProcessingController {
def DisplayImage() {
def classified = Classified.findById(params.id)
byte[] imageInByte=classified.photos
response.contentType = 'image/png' // or the appropriate image content type
response.outputStream << imageInByte
response.outputStream.flush()
}
}
GSP code snippet:
<td><img height=100, width=100 src="${createLink(controller: 'ImageProcessing', action: 'DisplayImage', params: ['id': classifiedInstance.id])}"/></td>
======================================================================= What I learnt: 1. response.setHeader was throwing exception. Not sure why
response.setHeader('Content-length', imageInByte.length)
2. No need to convert byte array to Byte array using "toByteArray()"