FIRST WORKING VERSION
diff --git a/js/JavaSocketBridge.jar b/js/JavaSocketBridge.jar
index c7d0c3b..4a61f3e 100644
--- a/js/JavaSocketBridge.jar
+++ b/js/JavaSocketBridge.jar
Binary files differ
diff --git a/js/java_socket_bridge.js b/js/java_socket_bridge.js
index f2ee60d..68c2e9e 100644
--- a/js/java_socket_bridge.js
+++ b/js/java_socket_bridge.js
@@ -32,8 +32,6 @@
}
-
-
// Send Test Interest
function get(host,port,data){
if(java_socket_bridge_ready_flag){
@@ -46,10 +44,10 @@
// Send Test Interest
-function put(host,port,data,name){
+function put(host,port,data,name,toReturn){
if(java_socket_bridge_ready_flag){
- return get_java_socket_bridge().put(host,port,data,name);
+ return get_java_socket_bridge().put(host,port,data,name,toReturn);
}
else{
on_socket_error("Java Socket Bridge send Interest until the applet has loaded");
diff --git a/js/lwNDN.js b/js/lwNDN.js
index cb9e8fc..d68196a 100644
--- a/js/lwNDN.js
+++ b/js/lwNDN.js
@@ -68,7 +68,6 @@
lwNDN.prototype.put = function(name,content){
if(this.host!=null && this.port!=null){
-
name = name.trim();
var fe = new ForwardingEntry('selfreg',new ContentName(name),null, null, 3,2147483647);
@@ -86,7 +85,7 @@
var ccnxnodename = unescape('%E0%A0%1E%099h%F9t%0C%E7%F46%1B%AB%F5%BB%05%A4%E5Z%AC%A5%E5%8Fs%ED%DE%B8%E0%13%AA%8F');
- var interestName = new ContentName(['ccnx',ccnxnodename,'prefixreg',coBinary]);
+ var interestName = new ContentName(['ccnx',ccnxnodename,'selfreg',coBinary]);
int = new Interest(interestName);
int.Scope = 1;
@@ -97,13 +96,44 @@
console.log(hex);
- var result = put(this.host,this.port, hex,name);
+ //var result = put(this.host,this.port, hex,name);
- return result;
+
+ //if(LOG>3)console.log('received interest'); //from host'+ host +':'+port+' with name '+name);
+
+ //if(LOG>3)console.log('DATA ');
+
+ //if(LOG>3)console.log(result);
+
+ //interest = decodeHexInterest(result);
+
+ //console.log('SUCCESSFULLY PARSED INTEREST');
+
+ console.log('CREATING ANSWER');
+ var si = new SignedInfo();
+ si.setFields();
+
+ var answer = DataUtils.toNumbersFromString(content);
+ var co = new ContentObject(new ContentName(name),si,answer,new Signature());
+ co.sign();
+
+
+ var outputHex = encodeToHexContentObject(co);
+
+ //console.log('SENDING ANSWER');
+
+ //return get_java_socket_bridge().putAnswer(outputHex,name);
+
+
+ var result = put(this.host,this.port, hex,name,outputHex);
+
+
+ return result;
}
else{
+
console.log('ERROR URL OR PORT NOT SET');
return null;
diff --git a/js/test-request-data.html b/js/test-request-data.html
index 11a69b0..65dd8c1 100644
--- a/js/test-request-data.html
+++ b/js/test-request-data.html
@@ -160,12 +160,10 @@
output += "DER Certificate: "+publickey ;
-
+
output+= "<br />";
output+= "<br />";
-
-
if(LOG>2) console.log(" ContentName + SignedInfo + Content = "+input);
if(LOG>2) console.log(" PublicKey = "+publickey );
if(LOG>2) console.log(" PublicKeyHex = "+publickeyHex );