Add geoip support and flag icons
This commit is contained in:
27
apps/routerconsole/jsp/flags.jsp
Normal file
27
apps/routerconsole/jsp/flags.jsp
Normal file
@ -0,0 +1,27 @@
|
||||
<%
|
||||
/*
|
||||
* USE CAUTION WHEN EDITING
|
||||
* Trailing whitespace OR NEWLINE on the last line will cause
|
||||
* IllegalStateExceptions !!!
|
||||
*/
|
||||
|
||||
/**
|
||||
* flags.jsp?c=de => icons/flags/de.png
|
||||
* with headers set so the browser caches.
|
||||
*/
|
||||
boolean rendered = false;
|
||||
String c = request.getParameter("c");
|
||||
if (c != null && c.length() > 0) {
|
||||
java.io.OutputStream cout = response.getOutputStream();
|
||||
response.setContentType("image/png");
|
||||
response.setHeader("Cache-Control", "max-age=86400"); // cache for a day
|
||||
try {
|
||||
net.i2p.util.FileUtil.readFile(c + ".png", "icons/flags", cout);
|
||||
rendered = true;
|
||||
} catch (java.io.IOException ioe) {}
|
||||
if (rendered)
|
||||
cout.close();;
|
||||
}
|
||||
if (!rendered)
|
||||
response.sendError(404, "Not found");
|
||||
%>
|
Reference in New Issue
Block a user