Skip to content

Instantly share code, notes, and snippets.

@renatoathaydes
Created May 24, 2014 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoathaydes/cf7ae6174f6718bc13ee to your computer and use it in GitHub Desktop.
Save renatoathaydes/cf7ae6174f6718bc13ee to your computer and use it in GitHub Desktop.
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