Grails has a request object, which is defined here .
The problem is when I try to use it, I get:
No such property: request for class:xxx
Reading the first 100 hits sent by this error caused only one sentence:
import javax.servlet.http.HttpServletRequest import org.springframework.web.context.request.ServletRequestAttributes : def my() { HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); }
However, this gives:
groovy.lang.MissingPropertyException: No such property: RequestContextHolder for class: net.ohds.ReportService
- How to get a handle to a request object in Grails?
- How do you know about this? So few people asked this question, it should be documented somewhere or in some example, but I canβt find it.
source share