Changeset e8d9498


Ignore:
Timestamp:
Apr 28, 2011 6:01:48 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
525e0b45
Parents:
38db0b0f
Message:
Location:
apps/routerconsole/jsp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/jsp/flags.jsp

    r38db0b0f re8d9498  
    1212 *  with headers set so the browser caches.
    1313 */
    14 boolean rendered = false;
    1514String c = request.getParameter("c");
    1615if (c != null && c.length() > 0) {
     
    3938    try {
    4039        net.i2p.util.FileUtil.readFile(file, base, cout);
    41         rendered = true;
    42     } catch (java.io.IOException ioe) {}
    43     if (rendered)
    44         cout.close();
     40    } catch (java.io.IOException ioe) {
     41        // prevent 'Committed' IllegalStateException from Jetty
     42        if (!response.isCommitted()) {
     43            response.sendError(403, ioe.toString());
     44        }  else {
     45            net.i2p.I2PAppContext.getGlobalContext().logManager().getLog(getClass()).error("Error serving flags/" + c + ".png", ioe);
     46            // Jetty doesn't log this
     47            throw ioe;
     48        }
     49    }
     50} else {
     51    /*
     52     *  Send a 403 instead of a 404, because the server sends error.jsp
     53     *  for 404 errors, complete with the summary bar, which would be
     54     *  a huge load for a page full of flags if the user didn't have the
     55     *  flags directory for some reason.
     56     */
     57    response.sendError(403, "No flag specified");
    4558}
    46 /*
    47  *  Send a 403 instead of a 404, because the server sends error.jsp
    48  *  for 404 errors, complete with the summary bar, which would be
    49  *  a huge load for a page full of flags if the user didn't have the
    50  *  flags directory for some reason.
    51  */
    52 if (!rendered)
    53     response.sendError(403, "Flag not found");
    5459%>
  • apps/routerconsole/jsp/viewhistory.jsp

    r38db0b0f re8d9498  
    1212    net.i2p.util.FileUtil.readFile("history.txt", base, response.getOutputStream());
    1313} catch (java.io.IOException ioe) {
    14     response.sendError(403, ioe.toString());
     14    // prevent 'Committed' IllegalStateException from Jetty
     15    if (!response.isCommitted()) {
     16        response.sendError(403, ioe.toString());
     17    }  else {
     18        net.i2p.I2PAppContext.getGlobalContext().logManager().getLog(getClass()).error("Error serving history.txt", ioe);
     19        // Jetty doesn't log this
     20        throw ioe;
     21    }
    1522}
    1623%>
  • apps/routerconsole/jsp/viewtheme.jsp

    r38db0b0f re8d9498  
    6464    net.i2p.util.FileUtil.readFile(uri, base, response.getOutputStream());
    6565} catch (java.io.IOException ioe) {
    66     response.sendError(403, ioe.toString());
     66    // prevent 'Committed' IllegalStateException from Jetty
     67    if (!response.isCommitted()) {
     68        response.sendError(403, ioe.toString());
     69    }  else {
     70        net.i2p.I2PAppContext.getGlobalContext().logManager().getLog(getClass()).error("Error serving " + uri, ioe);
     71        // Jetty doesn't log this
     72        throw ioe;
     73    }
    6774}
    6875%>
Note: See TracChangeset for help on using the changeset viewer.