getting the request in Grails service

1.4k views Asked by At

In Grails Service i'm trying to get the request but i'm getting the below error :

 No such property: theRequest for class:   com.sherif.utils.MyService

here is my code in the service:

def theRequest = WebUtils.retrieveGrailsWebRequest().getCurrentRequest()

anything missing ?

Thanks

1

There are 1 answers

0
Ari Bustamante On

You might try this instead:

def getTheRequest() {
    WebUtils.retrieveGrailsWebRequest().getCurrentRequest()
}

You should be able to call that the same way as a property:

myService.theRequest