Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Misc Groovy Scripts that invoke the Firebase APIs
def firebaseJsonData = ""
def data = firebaseJsonData.toURL().getText()
return data;
def firebaseJsonData = ""
def data = firebaseJsonData.toURL().getText()
def javascriptEditor = eclipse.registry.editor("JavaScript Editor");
return javascriptEditor;
<!DOCTYPE html>
<meta charset="US-ASCII">
<title>Firebase test</title>
<script src='' ></script>
<script src=''></script>
var myRootRef = new Firebase('');
//myRootRef.push({name: 'Now using PUSH', text: 'Hello World Again!'});
//myRootRef.set("Value from Javascript");
myRootRef.on('child_added', function(snapshot)
//message = snapshot.valueOf().val();
//displayChatMessage("message", message);
message = snapshot.val();
displayChatMessage(, message.text);
function displayChatMessage(name, text)
$('<div/>').html(text).prepend($('<em/>').text(name+': '))
<div id="messagesDiv"></div>
def firebaseUrl = "";
dataToSubmit = ' { "name" : "Groovy" , ' +
' "text" : "Hello there from Groovy" }'
def connection = firebaseUrl.toURL().openConnection()
connection.outputStream.withWriter {
Writer writer -> writer << dataToSubmit;
def response = connection.inputStream.withReader { Reader reader -> reader.text }
return response;

This comment has been minimized.

Copy link

anselmoshim commented Oct 10, 2015

How do I fix an issue with "java.lang.SecurityException: Invoking methods on class is not allowed"? for

def connection = firebaseUrl.toURL().openConnection()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.