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 | |
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame] | 10 | <script type="text/javascript" src="../util/CCNProtocolDTags.js"></script> |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 11 | |
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame] | 12 | <script type="text/javascript" src="../util/CCNTime.js"></script> |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 13 | |
| 14 | <script type="text/javascript" src="../Name.js"></script> |
| 15 | |
| 16 | <script type="text/javascript" src="../ContentObject.js"></script> |
| 17 | |
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame] | 18 | <script type="text/javascript" src="../encoding/DateFormat.js"></script> |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 19 | |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 20 | <script type="text/javascript" src="../Interest.js"></script> |
| 21 | |
Jeff Thompson | c316472 | 2012-09-30 18:35:02 -0700 | [diff] [blame] | 22 | <script type="text/javascript" src="../Key.js"></script> |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 23 | |
| 24 | <script type="text/javascript" src="../PublisherID.js"></script> |
| 25 | |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 26 | <script type="text/javascript" src="../PublisherPublicKeyDigest.js"></script> |
| 27 | |
| 28 | <script type="text/javascript" src="../FaceInstance.js"></script> |
| 29 | |
| 30 | <script type="text/javascript" src="../ForwardingEntry.js"></script> |
| 31 | |
| 32 | |
| 33 | <script type="text/javascript" src="../encoding/BinaryXMLEncoder.js"></script> |
| 34 | |
Jeff Thompson | e06b31e | 2012-09-30 17:19:19 -0700 | [diff] [blame] | 35 | <script type="text/javascript" src="../encoding/BinaryXMLDecoder.js"></script> |
| 36 | |
| 37 | <script type="text/javascript" src="../encoding/DataUtils.js"></script> |
| 38 | |
| 39 | <script type="text/javascript" src="../encoding/EncodingUtils.js"></script> |
| 40 | |
| 41 | <script type="text/javascript" src="../NDN.js"></script> |
| 42 | |
| 43 | <script language="JavaScript" type="text/javascript" src="../security/KeyManager.js"></script> |
| 44 | |
| 45 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn.js"></script> |
| 46 | <script language="JavaScript" type="text/javascript" src="../securityLib/jsbn2.js"></script> |
| 47 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa.js"></script> |
| 48 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsa2.js"></script> |
| 49 | |
| 50 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha1.js"></script> |
| 51 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha256.js"></script> |
| 52 | <script language="JavaScript" type="text/javascript" src="../securityLib/sha512.js"></script> |
| 53 | <script language="JavaScript" type="text/javascript" src="../securityLib/md5.js"></script> |
| 54 | <script language="JavaScript" type="text/javascript" src="../securityLib/ripemd160.js"></script> |
| 55 | <script language="JavaScript" type="text/javascript" src="../securityLib/base64.js"></script> |
| 56 | |
| 57 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsapem-1.1.js"></script> |
| 58 | <script language="JavaScript" type="text/javascript" src="../securityLib/rsasign-1.2.js"></script> |
| 59 | <script language="JavaScript" type="text/javascript" src="../securityLib/asn1hex-1.1.js"></script> |
| 60 | <script language="JavaScript" type="text/javascript" src="../securityLib/x509-1.1.js"></script> |
| 61 | |
| 62 | <script type="text/javascript"> |
| 63 | var loadedImageString = ""; |
| 64 | var connector = new NDN(); |
| 65 | var pieceNumber = 0; |
| 66 | var count = 0; |
| 67 | var end = false; |
| 68 | var LOG = 0; |
| 69 | var pieceSize = 1000; |
| 70 | |
| 71 | |
| 72 | function getPiece(){ |
| 73 | if(!pieceNumber) pieceNumber = 0; |
| 74 | var contentName = "/image/piece" + pieceNumber; |
| 75 | var co = connector.get( contentName ); |
| 76 | |
| 77 | if(co){ |
| 78 | loadedImageString += DataUtils.toString(co.content); |
| 79 | console.log("Received length: " + co.content.length); |
| 80 | if(co.content.length == pieceSize){ |
| 81 | pieceNumber += co.content.length; |
| 82 | getPiece(); |
| 83 | } |
| 84 | else document.getElementById('image').src += loadedImageString; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | </script> |
| 93 | |
| 94 | </head> |
| 95 | <body > |
| 96 | <div> |
| 97 | <button onclick="getPiece()">Get image</button> |
| 98 | </div> |
| 99 | <div > |
| 100 | <applet id="JavaSocketBridge" archive="../JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0"> |
| 101 | </applet> |
| 102 | </div> |
| 103 | |
| 104 | <p id="result"></p> |
| 105 | <div> |
| 106 | <img id="image" src="data:image/png;base64," alt="Image placeholder" /> |
| 107 | </div> |
| 108 | |
| 109 | </body> |
| 110 | </html> |