Okay, so running the following code in a groovy script allows you to fetch strings from a form and then manipulate them in jruby. It's an odd solution though.
import javax.script.Bindings;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.SimpleBindings;
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jruby");
Bindings bindings = new SimpleBindings();
def message = execution.getVariable('username');
def quote = "\"";
message = "$quote$message$quote";
bindings.put("message", message);
engine.eval("puts $message");
For some reason you have to add extra quotes around the string, otherwise groovy interprets it as a variable name instead of a string and just tells you it doesn't have access to variable '(your form input string)'.
This is messy though, and fraught with what I would consider bad coding practices. But hey, it works.