Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -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 Request </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="ContentName.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="KeyName.js"></script> |
| 31 | |
| 32 | <script type="text/javascript" src="PublisherID.js"></script> |
| 33 | |
| 34 | <script type="text/javascript" src="Signature.js"></script> |
| 35 | |
| 36 | <script type="text/javascript" src="SignedInfo.js"></script> |
| 37 | |
| 38 | <script type="text/javascript" src="PublisherPublicKeyDigest.js"></script> |
| 39 | |
| 40 | <script type="text/javascript" src="FaceInstance.js"></script> |
| 41 | |
| 42 | <script type="text/javascript" src="ForwardingEntry.js"></script> |
| 43 | |
| 44 | |
| 45 | <script type="text/javascript" src="encoding/BinaryXMLEncoder.js"></script> |
| 46 | |
| 47 | <script type="text/javascript" src="encoding/BinaryXMLCodec.js"></script> |
| 48 | |
| 49 | <script type="text/javascript" src="encoding/BinaryXMLDecoder.js"></script> |
| 50 | |
| 51 | <script type="text/javascript" src="encoding/DataUtils.js"></script> |
| 52 | |
| 53 | <script type="text/javascript" src="encoding/EncodingUtils.js"></script> |
| 54 | |
| 55 | <script type="text/javascript" src="lwNDN.js"></script> |
| 56 | |
| 57 | <script language="JavaScript" type="text/javascript" src="security/KeyManager.js"></script> |
| 58 | |
| 59 | <script language="JavaScript" type="text/javascript" src="securityLib/jsbn.js"></script> |
| 60 | <script language="JavaScript" type="text/javascript" src="securityLib/jsbn2.js"></script> |
| 61 | <script language="JavaScript" type="text/javascript" src="securityLib/rsa.js"></script> |
| 62 | <script language="JavaScript" type="text/javascript" src="securityLib/rsa2.js"></script> |
| 63 | |
| 64 | <script language="JavaScript" type="text/javascript" src="securityLib/sha1.js"></script> |
| 65 | <script language="JavaScript" type="text/javascript" src="securityLib/sha256.js"></script> |
| 66 | <script language="JavaScript" type="text/javascript" src="securityLib/sha512.js"></script> |
| 67 | <script language="JavaScript" type="text/javascript" src="securityLib/md5.js"></script> |
| 68 | <script language="JavaScript" type="text/javascript" src="securityLib/ripemd160.js"></script> |
| 69 | <script language="JavaScript" type="text/javascript" src="securityLib/base64.js"></script> |
| 70 | |
| 71 | <script language="JavaScript" type="text/javascript" src="securityLib/rsapem-1.1.js"></script> |
| 72 | <script language="JavaScript" type="text/javascript" src="securityLib/rsasign-1.2.js"></script> |
| 73 | <script language="JavaScript" type="text/javascript" src="securityLib/asn1hex-1.1.js"></script> |
| 74 | <script language="JavaScript" type="text/javascript" src="securityLib/x509-1.1.js"></script> |
| 75 | |
| 76 | <script type="text/javascript"> |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 77 | var loadedImageString = ""; |
| 78 | var connector = new lwNDN('127.0.0.1', 9695); |
| 79 | var pieceNumber = 0; |
| 80 | var count = 0; |
| 81 | var end = false; |
| 82 | var LOG = 0; |
Axel Colin de Verdiere | 7ce2834 | 2012-06-06 08:21:06 -0700 | [diff] [blame^] | 83 | var pieceSize = 1000; |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 84 | |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 85 | |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 86 | function getPiece(){ |
| 87 | if(!pieceNumber) pieceNumber = 0; |
| 88 | var contentName = "/image/piece" + pieceNumber; |
| 89 | // var connector = new lwNDN('127.0.0.1', 9695); |
| 90 | var co = connector.get( contentName ); |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 91 | |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 92 | if(co){ |
| 93 | loadedImageString += DataUtils.toString(co.Content); |
Axel Colin de Verdiere | 7ce2834 | 2012-06-06 08:21:06 -0700 | [diff] [blame^] | 94 | console.log("Received length: " + co.Content.length); |
| 95 | if(co.Content.length == pieceSize){ |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 96 | pieceNumber += co.Content.length; |
| 97 | getPiece(); |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 98 | } |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 99 | else document.getElementById('image').src += loadedImageString; |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 100 | } |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 106 | |
| 107 | </script> |
| 108 | |
| 109 | </head> |
| 110 | <body > |
Axel Colin de Verdiere | 8f3758e | 2012-06-06 07:45:31 -0700 | [diff] [blame] | 111 | <div> |
| 112 | <button onclick="getPiece()">Get image</button> |
| 113 | </div> |
Axel Colin de Verdiere | d363e63 | 2012-06-06 05:16:43 -0700 | [diff] [blame] | 114 | <div > |
| 115 | <applet id="JavaSocketBridge" archive="JavaSocketBridge.jar" code="JavaSocketBridge.class" width="0" height="0"> |
| 116 | </applet> |
| 117 | </div> |
| 118 | |
| 119 | <p id="result"></p> |
| 120 | <div> |
| 121 | <img id="image" src="data:image/png;base64," alt="Red dot" /> |
| 122 | </div> |
| 123 | |
| 124 | </body> |
| 125 | </html> |