use of org.grails.gsp.io.GroovyPageScriptSource in project grails-core by grails.
the class GroovyPageViewResolver method createGrailsView.
protected View createGrailsView(String viewName) throws Exception {
// try GSP if res is null
GroovyObject controller = null;
GrailsWebRequest webRequest = GrailsWebRequest.lookup();
if (webRequest != null) {
HttpServletRequest request = webRequest.getCurrentRequest();
controller = webRequest.getAttributes().getController(request);
}
GroovyPageScriptSource scriptSource;
if (controller == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Locating GSP view for path {}", viewName);
}
scriptSource = groovyPageLocator.findViewByPath(viewName);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Locating GSP view for controller {} and path {}", controller, viewName);
}
scriptSource = groovyPageLocator.findView(controller, viewName);
}
if (scriptSource != null) {
return createGroovyPageView(scriptSource.getURI(), scriptSource);
}
return createFallbackView(viewName);
}
Aggregations