Commit 4255fa57 authored by Onadim, Izer's avatar Onadim, Izer
Browse files

[ieo119] Add choice between HTML and downloading markdown

parent 971be045
Pipeline #171086 failed with stages
in 1 second
......@@ -28,11 +28,13 @@ public class WebServer {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String query = req.getParameter("q");
String download = req.getParameter("download");
if (query == null) {
new IndexPage().writeTo(resp);
} else {
} else if ("md".equals(download)) {
new MarkdownDownload(query, new QueryProcessor().process(query)).writeTo(resp);
//new HTMLResultPage(query, new QueryProcessor().process(query)).writeTo(resp);
} else {
new HTMLResultPage(query, new QueryProcessor().process(query)).writeTo(resp);
}
}
}
......
......@@ -18,8 +18,12 @@ public class IndexPage implements Page {
// Content
writer.println(
"<h1>Welcome!!</h1>" +
"<p>Enter your query in the box below: " +
"<form>" +
"<input type=\"radio\" name=\"download\" value=\"md\">" +
"<label for=\"download\">Download Markdown</label><br>" +
"<input type=\"radio\" name=\"download\" value=\"html\">" +
"<label for=\"download\">HTML</label><br>" +
"<p>Enter your query in the box below:<br>" +
"<input type=\"text\" name=\"q\" />" +
"<br><br><input type=\"submit\">" +
"</form>" +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment