简体   繁体   中英

getting the request in Grails service

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM