source: apps/routerconsole/jsp/flags.jsp @ d2c939b

Last change on this file since d2c939b was d2c939b, checked in by zzz <zzz@…>, 11 years ago

typo

  • Property mode set to 100644
File size: 993 bytes
Line 
1<%
2/*
3 * USE CAUTION WHEN EDITING
4 * Trailing whitespace OR NEWLINE on the last line will cause
5 * IllegalStateExceptions !!!
6 */
7
8/**
9 *  flags.jsp?c=de => icons/flags/de.png
10 *  with headers set so the browser caches.
11 */
12boolean rendered = false;
13String c = request.getParameter("c");
14if (c != null && c.length() > 0) {
15    java.io.OutputStream cout = response.getOutputStream();
16    response.setContentType("image/png");
17    response.setHeader("Cache-Control", "max-age=86400");  // cache for a day
18    String base = net.i2p.I2PAppContext.getGlobalContext().getBaseDir().getAbsolutePath();
19    String file = "docs" + java.io.File.separatorChar + "icons" + java.io.File.separatorChar +
20                  "flags" + java.io.File.separatorChar + c + ".png";
21    try {
22        net.i2p.util.FileUtil.readFile(file, base, cout);
23        rendered = true;
24    } catch (java.io.IOException ioe) {}
25    if (rendered)
26        cout.close();
27}
28if (!rendered)
29    response.sendError(404, "Not found");
30%>
Note: See TracBrowser for help on using the repository browser.