use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunGroovyTest method testClosureWithDefaultParam.
public void testClosureWithDefaultParam() throws Exception {
GroovyObject object = compile("src/test/groovy/ClosureWithDefaultParamTest.groovy");
object.invokeMethod("methodWithDefaultParam", null);
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunGroovyTest method testMap.
public void testMap() throws Exception {
GroovyObject object = compile("src/test/groovy/MapTest.groovy");
object.invokeMethod("testMap", null);
}
use of groovy.lang.GroovyObject in project groovy-core by groovy.
the class RunGroovyTest method testClosure.
public void testClosure() throws Exception {
GroovyObject object = compile("src/test/groovy/ClosureMethodTest.groovy");
object.invokeMethod("testListCollect", null);
}
use of groovy.lang.GroovyObject in project grails-core by grails.
the class DefaultGrailsApplicationAttributes method getControllerName.
private String getControllerName(ServletRequest request) {
String controllerName = (String) request.getAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE);
if (controllerName == null || controllerName.length() == 0) {
GroovyObject controller = getController(request);
if (controller != null) {
controllerName = (String) controller.getProperty("controllerName");
request.setAttribute(GrailsApplicationAttributes.CONTROLLER_NAME_ATTRIBUTE, controllerName);
if (controller instanceof GrailsControllerClass) {
String namespace = ((GrailsControllerClass) controller).getNamespace();
if (namespace != null) {
request.setAttribute(GrailsApplicationAttributes.CONTROLLER_NAMESPACE_ATTRIBUTE, namespace);
}
}
}
}
return controllerName != null ? controllerName : "";
}
use of groovy.lang.GroovyObject 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