| <?xml version = "1.0" encoding="utf-8" ?> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| "DTD/xhtml1-strict.dtd"> |
| <html xmlns = "http://www.w3.org/1999/xhtml"> |
| |
| <head> |
| <title>NDN Image Loader</title> |
| <script type="text/javascript" src="../java_socket_bridge.js"></script> |
| |
| <script type="text/javascript" src="../util/CCNProtocolDTags.js"></script> |
| |
| <script type="text/javascript" src="../util/CCNTime.js"></script> |
| |
| <script type="text/javascript" src="../Name.js"></script> |
| |
| <script type="text/javascript" src="../ContentObject.js"></script> |
| |
| <script type="text/javascript" src="../encoding/DateFormat.js"></script> |
| |
| <script type="text/javascript" src="../Interest.js"></script> |
| |
| <script type="text/javascript" src="../Key.js"></script> |
| |
| <script type="text/javascript" src="../PublisherID.js"></script> |
| |
| <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script> |
| |
| <script type="text/javascript" src="../FaceInstance.js"></script> |
| |
| <script type="text/javascript" src="../ForwardingEntry.js"></script> |
| |
| |
| <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script> |
| |
| <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script> |
| |
| <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script> |
| |
| <script type="text/javascript" src="../encoding/DataUtils.js"></script> |
| |
| <script type="text/javascript" src="../encoding/EncodingUtils.js"></script> |
| |
| <script type="text/javascript" src="../NDN.js"></script> |
| |
| <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script> |
| |
| <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script> |
| |
| <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script> |
| |
| <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script> |
| <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script> |
| |
| <script type="text/javascript"> |
| var loadedImageString = ""; |
| var connector = new NDN(); |
| var pieceNumber = 0; |
| var count = 0; |
| var end = false; |
| var LOG = 0; |
| var pieceSize = 1000; |
| |
| |
| function getPiece(){ |
| if(!pieceNumber) pieceNumber = 0; |
| var contentName = "/image/piece" + pieceNumber; |
| var co = connector.get( contentName ); |
| |
| if(co){ |
| loadedImageString += DataUtils.toString(co.content); |
| console.log("Received length: " + co.content.length); |
| if(co.content.length == pieceSize){ |
| pieceNumber += co.content.length; |
| getPiece(); |
| } |
| else document.getElementById('image').src += loadedImageString; |
| } |
| } |
| |
| |
| |
| |
| |
| </script> |
| |
| </head> |
| <body > |
| <div> |
| <button onclick="getPiece()">Get image</button> |
| </div> |
| <div > |
| <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0"> |
| </applet> |
| </div> |
| |
| <p id="result"></p> |
| <div> |
| <img id="image" src="data:image/png;base64," alt="Image placeholder" /> |
| </div> |
| |
| </body> |
| </html> |