- Timestamp:
- 09/24/19 14:13:26 (5 years ago)
- Location:
- src/main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/geniusweb/runserver/PartyConnection.java
r1 r4 33 33 34 34 /** 35 * A websocket based {@link ConnectionWithParty}. Must be public so that it can 36 * be accessed as ClientEndpoint by apache tomcat 35 * A websocket based {@link ConnectionWithParty}. it contains a websocket 36 * connection to a party that runs on a runserver. Must be public so that it can 37 * be accessed as ClientEndpoint by apache tomcat. This is internally used. 37 38 */ 38 39 @ClientEndpoint … … 102 103 .openConnection(); 103 104 // if this throws, the IOException seems to contain the "retry later" 104 // message 105 // already 106 conn.setRequestMethod("GET"); // TODO timeout 105 // message already 106 conn.setRequestMethod("GET"); 107 conn.setReadTimeout(20000); 108 conn.connect(); 107 109 BufferedReader rd; 108 110 try { … … 110 112 new InputStreamReader(conn.getInputStream())); 111 113 } catch (IOException e) { 114 if (conn.getErrorStream() == null) { 115 throw new IOException("Failed to connect " + reference 116 + ", no server error message", e); 117 } 112 118 // read the detail message from the error stream 113 119 rd = new BufferedReader( -
src/main/java/geniusweb/runserver/RunNego.java
r1 r4 66 66 RunningNegotiationsRepo.instance(), log); 67 67 RunningNegotiationsRepo.instance().put(session); 68 // set content type to prevent some browsers 69 // trying to parse this (eg as XML) 70 response.setContentType("application/json"); 68 71 response.getWriter().append(session.getID()); 69 72 } -
src/main/webapp/index.jsp
r1 r4 1 1 <html> 2 2 <body> 3 <h1>Genius 2Run Server</h1>3 <h1>GeniusWeb Run Server</h1> 4 4 5 5 <a href="newsession.xhtml">new session</a> … … 10 10 <br> 11 11 <a href="log">view logs</a> 12 <br> 12 <p> 13 For help and more info, please refer to the <a href="https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebRunServer"> run server page</a>. 13 14 </body> 14 15 </html> -
src/main/webapp/newsession.xhtml
r2 r4 40 40 <div id="box" class="box"> 41 41 <br /> <b>Participants</b> <br /> Parties Server: <input type="url" 42 name="url" id="partiesserverurl" value="localhost:8080/partiesserver-1.0.0" 42 name="url" id="partiesserverurl" 43 value="localhost:8080/partiesserver-1.0.0" 43 44 pattern=".*:[0-9]+/partiesserver" size="30" 44 onchange="connectParties()"> </input> <br /> 45 <br /> <b>Editnext party</b> <br /> Party: <select id="partyselection">45 onchange="connectParties()"> </input> <br /> <br /> <b>Edit 46 next party</b> <br /> Party: <select id="partyselection"> 46 47 </select> <br /> Profile: <select id="profileselection"> 47 48 </select> <br /> … … 71 72 72 73 <div id="started" style="visibility: hidden"> 74 Your session started. Waiting for the results. <br /> 75 </div> 76 <div id="results" style="visibility: hidden"> 73 77 Your session started.<br /> <a href="" id="logref">view the log 74 78 file</a> <br /> <a href="" id="plotref">render a utilities plot</a>. … … 78 82 79 83 <script type="application/javascript"> 84 80 85 81 86 … … 310 315 if (this.readyState == 4) { 311 316 if (this.status == 200) { 317 var logurl="log/"+this.responseText+".json"; 312 318 document.getElementById("startbutton").disabled=true; 313 document.getElementById("logref").href= "log/"+this.responseText+".json";319 document.getElementById("logref").href=logurl; 314 320 document.getElementById("plotref").href="plotlog.xhtml?id="+this.responseText; 321 document.getElementById("started").setAttribute("style",""); 315 322 316 sometimeWhen(function() { x=x+1; return x==3},317 function() { document.getElementById(" started").setAttribute("style",""); });323 sometimeWhen(function() { return urlExists(logurl) }, 324 function() { document.getElementById("results").setAttribute("style",""); }); 318 325 319 326 } … … 327 334 } 328 335 336 337 /** 338 @return true iff the URL exists. 339 */ 340 function urlExists(urlToFile) { 341 // Warning. Synchronous XMLHttpRequest on the main thread is 342 // deprecated because of its detrimental effects to the end user’s 343 // experience. For more help http://xhr.spec.whatwg.org/ 344 var xhr = new XMLHttpRequest(); 345 xhr.open('HEAD', urlToFile, false); 346 xhr.send(); 347 348 return (xhr.status == "200") 349 } 329 350 330 351 /** … … 361 382 362 383 384 363 385 </script> 364 386 -
src/main/webapp/plotlog.xhtml
r1 r4 23 23 <div id="progress">Waiting for log file name</div> 24 24 <br /> 25 <div style="width: 75%;">25 <div style="width: 100%;"> 26 26 <canvas id="canvas"></canvas> 27 27 </div>
Note:
See TracChangeset
for help on using the changeset viewer.