Grails 애플리케이션을 성공적으로 설정하여 사용자를 인증했습니다.@ Secure 클로저를 사용할 때 컨트롤러 메서드 매개 변수를 얻으려면 어떻게해야합니까?
내 UrlMappings.groovy에서 URL의 PARAMS를 사용하여 컨트롤러 메소드의 인수를,지도 :
"/$source/owner/$ownerId/show"(controller:"myController", action: "show", method: "GET")
은 어떻게 @Secured 폐쇄에 $ 소스의 값과 $ ownerId을받을 수 있나요?
내 컨트롤러 방법은 다음과 같습니다
@Secured(closure = {
//null
def testSource = params.source
//also null
def testOwnerId = params.ownerId
//null
def owner = request.ownerId
//null
def owner2 = request.getParameter('ownerId')
//contains only query string params
def grailsParams = request['org.codehaus.groovy.grails.WEB_REQUEST']?.params
return true
})
def show(String source, String ownerId) {
...
}
가 어떻게 이러한 값을받을 수 있나요? 내가 뭘 잘못 했니?
는이 게시물이 솔루션을 제공 할 수 있지만,이 주어진 대답은 나를 위해 작동하지 않았다 생각 :grails 2.5.1
compile ":spring-security-core:2.0-RC5"
compile ":spring-security-rest:1.5.3", {
excludes 'com.fasterxml.jackson.core:jackson-databind:'
}
: 나는 다음과 Grails의와 플러그인 버전을 사용하고
단순히 'def owner = request.ownerId'를하면 어떻게됩니까? 그것도 null입니까? – Gregg
@Gregg 귀하의 회신에 감사드립니다! 그러나이 또한 null을 반환합니다. – RMorrisey
그냥'println params'를 시도해보세요. 그럴 경우 배열 값에서 찾을 수 있습니다. –