-
-
Save wytten/5396905 to your computer and use it in GitHub Desktop.
A GSP (Groovy Server Pages) variation of the technique
This file contains 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
<% import org.codehaus.groovy.control.CompilerConfiguration %> | |
<% import org.wyttenbach.dale.groovy.spaceship.* %> | |
<% | |
response.setHeader("Cache-Control","no-cache"); | |
response.setHeader("Pragma","no-cache"); | |
response.setDateHeader ("Expires", 0); | |
%> | |
<link rel="stylesheet" href="css/sample.css" type="text/css"> | |
Here is a bunch of text | |
<hr/> | |
<% | |
// create a configuration | |
def config = new CompilerConfiguration() | |
// tweak the configuration | |
config.scriptBaseClass = 'org.wyttenbach.dale.groovy.spaceship.EngineScript' | |
// run your script | |
def shell = new GroovyShell(config) | |
def reader = new InputStreamReader(context.getResourceAsStream('/engine.groovy')) | |
engineScript = shell.evaluate(reader) | |
assert engineScript instanceof Engine | |
engineScript.start() | |
engineScript.stop() | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the start/stop messages appear in the log, not on the page.
I am using maven jetty plugin for testing