Reputation: 13839
I'm running a grails 1.3.9 application in Netbeans 7.1.1 IDE, and would like to decrease the session timeout for testing purposes. My prolem is I can't find a server.xml file under neither the NetBeansProjects nor the NetBeans folders. Is it located elsewhere or is it named differently ?
Thanks
Upvotes: 1
Views: 1117
Reputation: 98
You can also alter the build of the web.xml file with a groovy script '_Events.groovy' in the '/script' directory. You can use the 'eventWebXmlEnd' event to add your configuration:
import grails.util.Environment
import groovy.xml.StreamingMarkupBuilder
eventWebXmlEnd = { String tmpfile ->
def root = new XmlSlurper().parse(webXmlFile)
if(Environment.getCurrent() == 'TEST' ) {
root.appendNode {
'session-config' { 'session-timeout' (120) }
}
}
webXmlFile.text = new StreamingMarkupBuilder().bind {
mkp.declareNamespace("": "http://java.sun.com/xml/ns/javaee")
mkp.yield(root)
}
}
Upvotes: 1
Reputation: 35864
The session timeout is handled in the web.xml. You need to run grails install-templates which will give you a web.xml that you can manipulate. See the docs here.
You would add this to your web.xml
<session-config>
<session-timeout>120</session-timeout>
</session-config>
Upvotes: 0