Upgrade the Grails sample to Grails 3.2.6

Closes gh-357
This commit is contained in:
Andy Wilkinson
2017-03-03 16:57:55 +00:00
parent 722048e20f
commit 31ad4b40a0
12 changed files with 48 additions and 192 deletions

View File

@@ -1,48 +0,0 @@
/*
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example
import grails.core.GrailsApplication
import grails.util.Environment
class IndexController {
GrailsApplication grailsApplication
def index() {
render(contentType: 'application/json') {
message = "Welcome to Grails!"
environment = Environment.current.name
appversion = grailsApplication.metadata['info.app.version']
grailsversion = grailsApplication.metadata['info.app.grailsVersion']
appprofile = grailsApplication.config.grails?.profile
groovyversion = GroovySystem.getVersion()
jvmversion = System.getProperty('java.version')
controllers = array {
for (c in grailsApplication.controllerClasses) {
controller([name: c.fullName])
}
}
plugins = array {
for (p in grailsApplication.mainContext.pluginManager.allPlugins) {
plugin([name: p.fullName])
}
}
}
}
}

View File

@@ -1,28 +0,0 @@
/*
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example
class NotFoundController {
def index() {
render(contentType: 'application/json') {
error = 404
message = "Not Found"
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,18 @@
package com.example
class InternalServerErrorController {
class UrlMappings {
def index() {
render(contentType: 'application/json') {
error = 500
message = "Internal server error"
}
static mappings = {
delete "/$controller/$id(.$format)?"(action:"delete")
get "/$controller(.$format)?"(action:"index")
get "/$controller/$id(.$format)?"(action:"show")
post "/$controller(.$format)?"(action:"save")
put "/$controller/$id(.$format)?"(action:"update")
patch "/$controller/$id(.$format)?"(action:"patch")
"500"(view: '/error')
"404"(view: '/notFound')
}
}