WELCOME Abdennour : Software engineer

Nov 19, 2014

Externalize images in grails app from tomcat directory

_____________________________

class DocController{
     static externalPath='/usr/share/myproject/docs/'
    
    def img{
        def f=new File(externalPath+params?.id+'.png')
        response.contentType ='image/png'
        response.outputStream << f?.bytes
        response.outputStream.flush()
     }


}

____________________________________


if you have : /usr/share/myproject/docs/344.png , 

it will be accessed from



1 comment: