Skip to content

Commit

Permalink
Syntax edit to a method
Browse files Browse the repository at this point in the history
  • Loading branch information
ishita9 committed Oct 15, 2024
1 parent 5ffe99c commit 08be80a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions java/edu/ucar/metviewer/MVServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,25 @@ private void handleDownload(HttpServletRequest request, HttpServletResponse resp
private String resolveFilePath(HttpServletRequest request) {
String plot = MVUtil.cleanString(request.getParameter("plot"));
String type = request.getParameter("type");
return switch (type) {
case "plot_xml_url" -> plotXml + DELIMITER + plot + ".xml";
case "plot_sql_url" -> plotXml + DELIMITER + plot + ".sql";
case "plot_image_url" -> plots + DELIMITER + plot + ".png";
default -> plotXml + DELIMITER + plot + ".xml";
};
}
String filePath;

switch (type) {
case "plot_xml_url":
filePath = plotXml + DELIMITER + plot + ".xml";
break;
case "plot_sql_url":
filePath = plotXml + DELIMITER + plot + ".sql";
break;
case "plot_image_url":
filePath = plots + DELIMITER + plot + ".png";
break;
default:
filePath = plotXml + DELIMITER + plot + ".xml";
break;
}

return filePath;
}

private void sendDebugInfo(HttpServletResponse response) throws IOException {
response.setContentType("text/plain");
Expand Down

0 comments on commit 08be80a

Please sign in to comment.