I have a Grails action inside a controller. In this action I use:
def url = "http://www.somedomain.com/image/test.jpg"
def requestFactory = new SimpleClientHttpRequestFactory()
def request = requestFactory.createRequest(uri, method)
...
def response = request.execute()
if(statusCode == HttpStatus.OK) {
def responseImage = response.body.text
}
This returns a jpg image in my response.body.text object. I have no idea how I can handle this image. How can I convert this image to a byte array?