Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow subclasses of RestfulApiController #25

Open
Nathan-Smith opened this issue Feb 17, 2015 · 1 comment
Open

Allow subclasses of RestfulApiController #25

Nathan-Smith opened this issue Feb 17, 2015 · 1 comment

Comments

@Nathan-Smith
Copy link

Since groovy closures run in the context of the current class (sub-class) any private properties or methods in the superclass are inaccessible within the closure.

context.GrailsContextLoaderListener Error initializing the application: No such property: handlerConfig for class: com.example.SubClassRestfulApiController
groovy.lang.MissingPropertyException: No such property: handlerConfig for class: com.example.SubClassRestfulApiController
    at org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.propertyMissing(ControllerTagLibraryApi.java:121)
    at com.example.SubClassRestfulApiController.propertyMissing(SubClassRestfulApiController.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaClassImpl.invokeMissingProperty(MetaClassImpl.java:874)
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1853)
    at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1140)
    at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3690)
    at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:1152)
    at net.hedtech.restfulapi.RestfulApiController.getProperty(RestfulApiController.groovy)
    at com.example.SubClassRestfulApiController.getProperty(SubClassRestfulApiController.groovy)
    at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:168)
    at groovy.lang.Closure.getPropertyTryThese(Closure.java:321)
    at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:315)
    at groovy.lang.Closure.getProperty(Closure.java:304)
    at net.hedtech.restfulapi.RestfulApiController$_init_closure11.getProperty(RestfulApiController.groovy)
    at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
    at net.hedtech.restfulapi.RestfulApiController$_init_closure11.doCall(RestfulApiController.groovy:194)
@chasdev
Copy link
Contributor

chasdev commented Feb 21, 2015

Could you provide some background on why you have a need to subclass the controller? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants