WELCOME Abdennour : Software engineer

Showing posts with label grails. Show all posts
Showing posts with label grails. Show all posts

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



Aug 14, 2013

Sub List /Sub Array / Sub Collection with groovy



def  big=["azeae","azeazeaz","dfsdfsdf","kjkjk","ghf"];



____________________________________________
def sub1=big[2..big.size()-1]
 
>["dfsdfsdf","kjkjk","ghf"];



___________________________________________
def sub2=big[1..big.size()-2]
 
>["azeazeaz","dfsdfsdf","kjkjk"];