This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Problem: | |
| I want to leak exceptions that should not happen, so that the "500" mapping simply shows an error page. | |
| In my 500 page action, i check for ?showException=1, and if its there, I render the stock error.gsp. | |
| Now all this is fine and dandy, except the fact that I want to embed the perpetrator into the exception | |
| so I can list the errors. | |
| Code so far: | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| confirmField(validator: { val, obj -> | |
| def linkedField = propertyName += "Confirm" | |
| throw new RuntimeException("validating") | |
| if(obj.properties[linkedField] != val) { | |
| return ['confirmField.mismatch'] | |
| } | |
| return true | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //mapping | |
| "500"(controller:"foo", action:"bar") | |
| // | |
| class FooController { | |
| def bar = { | |
| response.sendError(200) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //the follow resides in Config.groovy | |
| //custom validator that checks if a linked field is identical | |
| confirmField(validator: { val, obj -> | |
| String linkedField = propertyName + "Confirm" //the error line | |
| if(obj.properties[linkedField] != val) { | |
| return ['confirmField.mismatch'] | |
| } | |
| return true | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Foo | |
| class Foo { | |
| String name | |
| static hasMany = [bar:Bar] | |
| void addSomeBars() { | |
| (1..10).each { i -> | |
| def bar = new Bar() | |
| bar.name = "bar nr: ${i}" | |
| println "Adding bar nr: ${i}" | |
| addToBar(bar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static namedQueries = { | |
| searchTree { query -> | |
| section { | |
| query.modern ? isNotNull("modernDepositionalSetting") : isNotNull("depositionalSetting") | |
| eq("grossDepositionalEnvironment", query.grossDepositionalEnvironment) | |
| depositionalSetting { | |
| if(query.basinType) 'in'("basinType", query.basinType) | |
| if(query.paleoClimate)'in'("paleoClimate", query.paleoClimate) | |
| } | |
| depositionalEnvironment { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //controller Page, with the 404 mapping in UrlMappings.groovy: "404"(controller:"page", action:"notFound") | |
| @Secured(['IS_AUTHENTICATED_ANONYMOUSLY']) | |
| def notFound () { | |
| def msg = | |
| [code:"404", | |
| descriptor:"page not found", | |
| strong: "The page you requested cannot be found", | |
| text:"If you got to this page by following a link, please notify an administrator."] | |
| render (view: "/shared/status", model: [msg:msg]) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INFO: Deploying web application archive ROOT.war | |
| SLF4J: Class path contains multiple SLF4J bindings. | |
| SLF4J: Found binding in [jar:file:/var/lib/tomcat6/webapps/ROOT/WEB-INF/lib/grails-plugin-logging-2.0.0.M2.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
| SLF4J: Found binding in [jar:file:/var/lib/tomcat6/webapps/ROOT/WEB-INF/lib/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
| SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. | |
| log4j:ERROR setFile(null,true) call failed. | |
| java.io.FileNotFoundException: stacktrace.log (Permission denied) | |
| at java.io.FileOutputStream.openAppend(Native Method) | |
| at java.io.FileOutputStream.<init>(FileOutputStream.java:192) | |
| at java.io.FileOutputStream.<init>(FileOutputStream.java:116) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SLF4J: Class path contains multiple SLF4J bindings. | |
| SLF4J: Found binding in [jar:file:/var/lib/tomcat6/webapps/ROOT/WEB-INF/lib/grails-plugin-logging-2.0.0.M2.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
| SLF4J: Found binding in [jar:file:/var/lib/tomcat6/webapps/ROOT/WEB-INF/lib/slf4j-simple-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] | |
| SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. | |
| 2011-10-14 14:18:43,330 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR StackTrace - Full Stack Trace: | |
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org.codehaus.groovy.grails.plugins.web.async.api.ControllersAsyncApi | |
| at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) | |
| at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chkconfig --list | |
| glassfish 0:off 1:off 2:off 3:on 4:off 5:off 6:off | |
| mongodb 0:off 1:off 2:on 3:on 4:on 5:on 6:off | |
| cat /etc/inittab | |
| id:3:initdefault: | |