Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame^] | 1 | <?xml version = "1.0" encoding="utf-8" ?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| 3 | "DTD/xhtml1-strict.dtd"> |
| 4 | <html xmlns = "http://www.w3.org/1999/xhtml"> |
| 5 | |
| 6 | <head> |
| 7 | <title>NDN Image Loader</title> |
| 8 | <script type="text/javascript" src="../java_socket_bridge.js"></script> |
| 9 | |
| 10 | <script type="text/javascript" src="../CCNProtocolDTags.js"></script> |
| 11 | |
| 12 | <script type="text/javascript" src="../CCNTime.js"></script> |
| 13 | |
| 14 | <script type="text/javascript" src="../Name.js"></script> |
| 15 | |
| 16 | <script type="text/javascript" src="../ContentObject.js"></script> |
| 17 | |
| 18 | <script type="text/javascript" src="../DateFormat.js"></script> |
| 19 | |
| 20 | <script type="text/javascript" src="../Exclude.js"></script> |
| 21 | |
| 22 | <script type="text/javascript" src="../ExcludeAny.js"></script> |
| 23 | |
| 24 | <script type="text/javascript" src="../ExcludeComponent.js"></script> |
| 25 | |
| 26 | <script type="text/javascript" src="../Interest.js"></script> |
| 27 | |
| 28 | <script type="text/javascript" src="../KeyLocator.js"></script> |
| 29 | |
| 30 | <script type="text/javascript" src="../PublisherID.js"></script> |
| 31 | |
| 32 | <script type="text/javascript" src="../Signature.js"></script> |
| 33 | |
| 34 | <script type="text/javascript" src="../SignedInfo.js"></script> |
| 35 | |
| 36 | <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script> |
| 37 | |
| 38 | <script type="text/javascript" src="../FaceInstance.js"></script> |
| 39 | |
| 40 | <script type="text/javascript" src="../ForwardingEntry.js"></script> |
| 41 | |
| 42 | |
| 43 | <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script> |
| 44 | |
| 45 | <script type="text/javascript" src="../encoding/BinaryXMLCodec.js"></script> |
| 46 | |
| 47 | <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script> |
| 48 | |
| 49 | <script type="text/javascript" src="../encoding/DataUtils.js"></script> |
| 50 | |
| 51 | <script type="text/javascript" src="../encoding/EncodingUtils.js"></script> |
| 52 | |
| 53 | <script type="text/javascript" src="../NDN.js"></script> |
| 54 | |
| 55 | <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script> |
| 56 | |
| 57 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script> |
| 58 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script> |
| 59 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script> |
| 60 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script> |
| 61 | |
| 62 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script> |
| 63 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script> |
| 64 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script> |
| 65 | <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script> |
| 66 | <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script> |
| 67 | <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script> |
| 68 | |
| 69 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script> |
| 70 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script> |
| 71 | <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script> |
| 72 | <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script> |
| 73 | |
| 74 | <script type="text/javascript"> |
| 75 | var loadedImageString = ""; |
| 76 | var connector = new NDN(); |
| 77 | var pieceNumber = 0; |
| 78 | var count = 0; |
| 79 | var end = false; |
| 80 | var LOG = 0; |
| 81 | var pieceSize = 1000; |
| 82 | |
| 83 | |
| 84 | function getPiece(){ |
| 85 | if(!pieceNumber) pieceNumber = 0; |
| 86 | var contentName = "/image/piece" + pieceNumber; |
| 87 | var co = connector.get( contentName ); |
| 88 | |
| 89 | if(co){ |
| 90 | loadedImageString += DataUtils.toString(co.content); |
| 91 | console.log("Received length: " + co.content.length); |
| 92 | if(co.content.length == pieceSize){ |
| 93 | pieceNumber += co.content.length; |
| 94 | getPiece(); |
| 95 | } |
| 96 | else document.getElementById('image').src += loadedImageString; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | </script> |
| 105 | |
| 106 | </head> |
| 107 | <body > |
| 108 | <div> |
| 109 | <button onclick="getPiece()">Get image</button> |
| 110 | </div> |
| 111 | <div > |
| 112 | <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0"> |
| 113 | </applet> |
| 114 | </div> |
| 115 | |
| 116 | <p id="result"></p> |
| 117 | <div> |
| 118 | <img id="image" src="data:image/png;base64," alt="Image placeholder" /> |
| 119 | </div> |
| 120 | |
| 121 | </body> |
| 122 | </html> |