Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A groovlet that logs access and serves a simple HTML page
if (!session) {
session = request.getSession(true);
}
if (!session.counter) {
session.counter = 1
}
html.html {
head {
title 'Simple Groovlet'
}
body {
h1 'Welcome to my Groovlet'
p "The current time at this server is ${new Date()}"
p "The session counter is now at ${sesson.counter}"
br()
p "System properties:"
ul {
for ( prop in System.properties.keySet()) {
li "$prop: ${System.getProperty(prop)}"
}
}
}
}
session.counter += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment