public class GroovySocketServer
extends java.lang.Object
implements java.lang.Runnable
new GroovySocketServer(
new GroovyShell(), // evaluator
false, // is not a file
"println line.reverse()", // script to evaluate
true, // return result to client
1960) //port
There are several variables in the script binding:
| Constructor and Description |
|---|
GroovySocketServer(GroovyShell groovy,
boolean isScriptFile,
java.lang.String scriptFilenameOrText,
boolean autoOutput,
int port)
This creates and starts the socket server on a new Thread.
|
| Modifier and Type | Method and Description |
|---|---|
void |
run()
Runs this server.
|
public GroovySocketServer(GroovyShell groovy, boolean isScriptFile, java.lang.String scriptFilenameOrText, boolean autoOutput, int port)
groovy - The GroovyShell object that evaluates the incoming text. If you need additional classes in the
classloader then configure that through this object.isScriptFile - Whether the incoming socket data String will be a script or a file path.scriptFilenameOrText - This will be a groovy script or a file location depending on the argument isScriptFile.autoOutput - whether output should be automatically echoed back to the clientport - the port to listen on