17 |
import java.util.Map; |
import java.util.Map; |
18 |
import java.util.logging.Level; |
import java.util.logging.Level; |
19 |
import java.util.logging.Logger; |
import java.util.logging.Logger; |
|
import java.util.zip.GZIPInputStream; |
|
20 |
import java.util.zip.ZipEntry; |
import java.util.zip.ZipEntry; |
21 |
import java.util.zip.ZipOutputStream; |
import java.util.zip.ZipOutputStream; |
22 |
|
|
84 |
return Arrays.copyOfRange(logFiles, from, to); |
return Arrays.copyOfRange(logFiles, from, to); |
85 |
} |
} |
86 |
|
|
87 |
protected PositionContainer getRequestsFromFileWorker(boolean multiple) throws IOException{ |
protected PositionContainer getRequestsFromFileWorker(int count) throws IOException{ |
88 |
PositionContainer positions = new PositionContainer(); |
PositionContainer positions = new PositionContainer(); |
89 |
|
|
90 |
try { |
try { |
|
|
|
|
int count; |
|
|
|
|
|
if (multiple == false) { |
|
|
count = 1; |
|
|
} else { |
|
|
count = 4; |
|
|
} |
|
91 |
|
|
92 |
File files[] = getFiles(count); |
File files[] = getFiles(count); |
93 |
|
|
336 |
return sb.toString(); |
return sb.toString(); |
337 |
} |
} |
338 |
|
|
339 |
protected String getRequestsFromFile(boolean multiple) throws IOException { |
protected String getRequestsFromFile(int count) throws IOException { |
340 |
String kmlData = null; |
String kmlData = null; |
341 |
String key; |
String key; |
342 |
|
|
343 |
if (multiple == false) { |
key = "kmldata-" + count; |
|
key = "kmldata"; |
|
|
} else { |
|
|
key = "kmldata-multi"; |
|
|
} |
|
344 |
|
|
345 |
kmlData = null;// = cache.get(key); |
kmlData = cache.get(key); |
346 |
|
|
347 |
if (kmlData == null) { |
if (kmlData == null) { |
348 |
kmlData = formatXml( getRequestsFromFileWorker(multiple) ); |
kmlData = formatXml( getRequestsFromFileWorker(count) ); |
349 |
cache.put(key, kmlData); |
cache.put(key, kmlData); |
350 |
kmlData += "<!-- from source -->"; |
kmlData += "<!-- from source -->"; |
351 |
} else { |
} else { |
371 |
@Override |
@Override |
372 |
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
373 |
|
|
|
boolean multiple = enabled( req.getParameter("multi") ); |
|
374 |
|
|
375 |
String kmlData = getRequestsFromFile(multiple); |
int count = Integer.parseInt( req.getParameter("count") ); |
376 |
|
|
377 |
|
if (count > 30) //limit to 30 days |
378 |
|
count = 30; |
379 |
|
|
380 |
|
String kmlData = getRequestsFromFile(count); |
381 |
|
|
382 |
if ( enabled(req.getParameter("zip")) ) { |
if ( enabled(req.getParameter("zip")) ) { |
383 |
|
|