/[projects]/android/TrainInfoService/WebContent/namesearch2.jsp
ViewVC logotype

Annotation of /android/TrainInfoService/WebContent/namesearch2.jsp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1509 - (hide annotations) (download)
Wed Jun 8 17:18:49 2011 UTC (12 years, 11 months ago) by torben
File size: 1189 byte(s)
page title
1 torben 1508 <%@ page import="java.util.*" %>
2     <%@ page import="java.io.*" %>
3     <%@ page import="dk.thoerup.traininfoservice.RequestPlotter" %>
4     <%@ page import="dk.thoerup.traininfoservice.RequestPlotter" %>
5     <%@ page import="dk.thoerup.genericjavautils.HttpUtil" %>
6    
7 torben 1509 <h2>searches byName</h2>
8 torben 1508
9     <table border='0'>
10     <tr><th>name</th><th>count</th></tr>
11     <%
12    
13     File files[] = RequestPlotter.getFiles(30);
14     TreeMap<String,Integer> names = new TreeMap<String,Integer>();
15    
16     for (File f : files ) {
17     if ( !f.exists() ) {
18     continue;
19     }
20    
21     InputStream input = new FileInputStream(f);
22    
23    
24     BufferedReader in = new BufferedReader( new InputStreamReader(input) );
25     String line;
26     while ( (line=in.readLine()) != null) {
27     if (line.indexOf("LocateStation") == -1 ){
28     continue;
29     }
30    
31     if (line.indexOf("name=") == -1 ) {
32     continue;
33     }
34     String parts[] = line.split(" ");
35    
36     String uri = parts[5];
37     String name = HttpUtil.decodeUri(uri).get("name");
38     Integer count = names.get(name);
39     if (count == null) {
40     count = 0;
41     }
42     names.put(name, count + 1);
43     }
44     }
45     for (Map.Entry<String,Integer> entry : names.entrySet() ) {
46     %>
47     <tr><td><%= entry.getKey() %></td><td><%= entry.getValue() %></td></tr>
48     <%
49     }
50    
51     %>
52    
53    
54     </table>

  ViewVC Help
Powered by ViewVC 1.1.20