| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library get.handler; | 5 library get.handler; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; |
| 10 | 11 |
| 11 import 'package:analysis_server/src/socket_server.dart'; | 12 import 'package:analysis_server/src/socket_server.dart'; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Instances of the class [GetHandler] handle GET requests. | 15 * Instances of the class [GetHandler] handle GET requests. |
| 15 */ | 16 */ |
| 16 class GetHandler { | 17 class GetHandler { |
| 17 /** | 18 /** |
| 18 * The path used to request the status of the analysis server as a whole. | 19 * The path used to request the status of the analysis server as a whole. |
| 19 */ | 20 */ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } else { | 60 } else { |
| 60 response.write('<p>Running</p>'); | 61 response.write('<p>Running</p>'); |
| 61 response.write('<h1>Analysis Contexts</h1>'); | 62 response.write('<h1>Analysis Contexts</h1>'); |
| 62 response.write('<h2>Summary</h2>'); | 63 response.write('<h2>Summary</h2>'); |
| 63 response.write('<table>'); | 64 response.write('<table>'); |
| 64 _writeRow( | 65 _writeRow( |
| 65 response, | 66 response, |
| 66 ['Context', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'], | 67 ['Context', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'], |
| 67 true); | 68 true); |
| 68 _server.analysisServer.contextMap.forEach((String key, AnalysisContext con
text) { | 69 _server.analysisServer.contextMap.forEach((String key, AnalysisContext con
text) { |
| 69 AnalysisContentStatistics statistics = | 70 AnalysisContextStatistics statistics = |
| 70 (context as AnalysisContextImpl).statistics; | 71 (context as AnalysisContextImpl).statistics; |
| 71 int errorCount = 0; | 72 int errorCount = 0; |
| 72 int flushedCount = 0; | 73 int flushedCount = 0; |
| 73 int inProcessCount = 0; | 74 int inProcessCount = 0; |
| 74 int invalidCount = 0; | 75 int invalidCount = 0; |
| 75 int validCount = 0; | 76 int validCount = 0; |
| 76 statistics.cacheRows.forEach((AnalysisContentStatistics_CacheRow row) { | 77 statistics.cacheRows.forEach((AnalysisContextStatistics_CacheRow row) { |
| 77 errorCount += row.errorCount; | 78 errorCount += row.errorCount; |
| 78 flushedCount += row.flushedCount; | 79 flushedCount += row.flushedCount; |
| 79 inProcessCount += row.inProcessCount; | 80 inProcessCount += row.inProcessCount; |
| 80 invalidCount += row.invalidCount; | 81 invalidCount += row.invalidCount; |
| 81 validCount += row.validCount; | 82 validCount += row.validCount; |
| 82 }); | 83 }); |
| 83 _writeRow(response, [ | 84 _writeRow(response, [ |
| 84 '<a href="#context_$key">$key</a>', | 85 '<a href="#context_$key">$key</a>', |
| 85 errorCount, | 86 errorCount, |
| 86 flushedCount, | 87 flushedCount, |
| 87 inProcessCount, | 88 inProcessCount, |
| 88 invalidCount, | 89 invalidCount, |
| 89 validCount]); | 90 validCount]); |
| 90 }); | 91 }); |
| 91 response.write('</table>'); | 92 response.write('</table>'); |
| 92 _server.analysisServer.contextMap.forEach((String key, AnalysisContext con
text) { | 93 _server.analysisServer.contextMap.forEach((String key, AnalysisContext con
text) { |
| 93 response.write('<h2><a name="context_$key">Analysis Context: $key</a></h
2>'); | 94 response.write('<h2><a name="context_$key">Analysis Context: $key</a></h
2>'); |
| 94 AnalysisContentStatistics statistics = (context as AnalysisContextImpl).
statistics; | 95 AnalysisContextStatistics statistics = (context as AnalysisContextImpl).
statistics; |
| 95 response.write('<table>'); | 96 response.write('<table>'); |
| 96 _writeRow( | 97 _writeRow( |
| 97 response, | 98 response, |
| 98 ['Item', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'], | 99 ['Item', 'ERROR', 'FLUSHED', 'IN_PROCESS', 'INVALID', 'VALID'], |
| 99 true); | 100 true); |
| 100 statistics.cacheRows.forEach((AnalysisContentStatistics_CacheRow row) { | 101 statistics.cacheRows.forEach((AnalysisContextStatistics_CacheRow row) { |
| 101 _writeRow( | 102 _writeRow( |
| 102 response, | 103 response, |
| 103 [row.name, | 104 [row.name, |
| 104 row.errorCount, | 105 row.errorCount, |
| 105 row.flushedCount, | 106 row.flushedCount, |
| 106 row.inProcessCount, | 107 row.inProcessCount, |
| 107 row.invalidCount, | 108 row.invalidCount, |
| 108 row.validCount]); | 109 row.validCount]); |
| 109 }); | 110 }); |
| 110 response.write('</table>'); | 111 response.write('</table>'); |
| 111 List<AnalysisException> exceptions = statistics.exceptions; | 112 List<CaughtException> exceptions = statistics.exceptions; |
| 112 if (!exceptions.isEmpty) { | 113 if (!exceptions.isEmpty) { |
| 113 response.write('<h2>Exceptions</h2>'); | 114 response.write('<h2>Exceptions</h2>'); |
| 114 exceptions.forEach((AnalysisException exception) { | 115 exceptions.forEach((CaughtException exception) { |
| 115 response.write('<p>${exception.message}</p>'); | 116 response.write('<p>${exception.exception}</p>'); |
| 116 }); | 117 }); |
| 117 } | 118 } |
| 118 }); | 119 }); |
| 119 } | 120 } |
| 120 response.write('</body>'); | 121 response.write('</body>'); |
| 121 response.write('</html>'); | 122 response.write('</html>'); |
| 122 response.close(); | 123 response.close(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 /** | 126 /** |
| (...skipping 24 matching lines...) Expand all Loading... |
| 150 response.write(value); | 151 response.write(value); |
| 151 response.write('</td>'); | 152 response.write('</td>'); |
| 152 }); | 153 }); |
| 153 if (header) { | 154 if (header) { |
| 154 response.write('</th>'); | 155 response.write('</th>'); |
| 155 } else { | 156 } else { |
| 156 response.write('</tr>'); | 157 response.write('</tr>'); |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 } | 160 } |
| OLD | NEW |