Closed droggo closed 8 years ago
Plugin views have some support but the resolution has some issues see TestGsonControllerSpec.groovy#L48
The compiled views and templates are available but the resolution mechanism isn't consistent.
Basically resolution of json-views & templates is broken when the plugin.fileSystemShortName
doesn't match the project.name of the plugin.
I have created a sample app to demonstrate this here: https://github.com/droggo/GsonViews It looks like any ".gson" file located in a plugin will not be resolved in application. We have explicitly set
views-json:1.0.8
, by default 1.0.4 was used. Grails version is 3.1.5Following endpoints can be checked:
Standard gson view defined in application. Working fine. Can also be accessed from plugin controller using
http://localhost:8080/plugin/appView
gson view which renders gson template also from application. Working fine.
gson view which renders gson template from plugin using:
json g.render(template: '/plugintemplate/plugintemplate', plugin: 'GsonPlugin')
. Throws exceptiongrails.views.ViewException: Template not found for name /plugintemplate/plugintemplate
. Also tried without 'plugin' parameter but no differencegson view defined in plugin. Throws exception
javax.servlet.ServletException: Could not resolve view with name 'pluginView' in servlet with name 'grailsDispatcherServlet'
gson view defined in plugin, rendering gson template from the same plugin. Throws exception
javax.servlet.ServletException: Could not resolve view with name 'pluginTemplate' in servlet with name 'grailsDispatcherServlet'
Impact is that we are not able to define any gson views or templates in plugins, everything must be defined in Application. Are we doing something wrong or is it a bug? If we can prepare something more let us know.
Shortened stacktrace for Template not found:
Stacktrace for could not resolve view: