Skip to content

Allow subclasses of RestfulApiController #25

@Nathan-Smith

Description

@Nathan-Smith

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions