Browse Source

Upgrade to Grails 2.3.2.BUILD-SNAPSHOT , use @CompileStatic in controller

Lari Hotari 11 years ago
parent
commit
d0dce487db

+ 2 - 2
grails/hello/application.properties

@@ -1,6 +1,6 @@
 #Grails Metadata file
-#Sun Sep 29 20:35:54 EEST 2013
-app.grails.version=2.3.0
+#Sun Oct 20 22:08:59 EEST 2013
+app.grails.version=2.3.2.BUILD-SNAPSHOT
 app.name=hello
 app.servlet.version=2.5
 app.version=0.1

+ 8 - 6
grails/hello/grails-app/controllers/hello/HelloController.groovy

@@ -1,19 +1,21 @@
 package hello
 
 import grails.converters.JSON
+import groovy.transform.CompileStatic
 import java.util.concurrent.ThreadLocalRandom
 
+@CompileStatic
 class HelloController {
 
     def index() {
-      def response = [
+      def msg = [
         message: "Hello, world"
       ]
-      render response as JSON
+      render msg as JSON
     }
 
-    def db() {
-      int queries = params.queries ? params.int('queries') : 1
+    def db(int queries) {
+      if(queries < 1) queries=1
       def worlds = new ArrayList(queries)
       def random = ThreadLocalRandom.current();
 
@@ -24,9 +26,9 @@ class HelloController {
     }
     
     def json() {
-      def response = [
+      def msg = [
         message: "Hello, world"
       ]
-      render response as JSON
+      render msg as JSON
     }
 }