// to be able to show user result of g:print() function
PrintStream out = new PrintStream(response.getOutputStream());
System.setOut(out);
try {
GremlinEvaluationJob job = GremlinSessions.getSession(sessionId, graphName,
rexsterApplication).evaluate(code);
List<String> lines = new ConsoleResultConverter(job.getOutputWriter()).convert(job.getResult());
for (String line : lines) {
out.println("==>" + line);
}
} catch (Exception e) {
out.println(e.getMessage());