if (req.getRequestURI().contains(";")) {
throw new ServletException("Invalid URL path parameter");
}
MessageQueue mq = new SimpleMessageQueue();
FetchedData result = handle(args, mq);
if (result == null) {
closeBadRequest(resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, mq);
return;
}
resp.setStatus(HttpServletResponse.SC_OK);
String responseContentType = result.getContentType();
if (result.getCharSet() != null) {
responseContentType += ";charset=" + result.getCharSet();
}
if (containsNewline(responseContentType)) {
throw new IllegalArgumentException(responseContentType);
}
try {
byte[] content = result.getByteContent();
resp.setContentType(responseContentType);
resp.setContentLength(content.length);
resp.setHeader(UMP.a, UMP.b);
resp.setHeader("X-Content-Type-Options", "nosniff");
resp.setHeader("Content-Disposition", "attachment; filename=f.txt");