blob: adc6f51114ad1d576b74b71ccb193b972da031bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package lq;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ViewQuote extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String idParam = req.getParameter("id");
Long id = Long.parseLong(idParam);
Quote quote = QuoteUtil.getQuoteWithId(id);
resp.setContentType("text/html");
resp.getWriter().println(header);
if (quote != null) {
Printer printer = new Printer(resp.getWriter());
printer.printQuote(quote);
}
else {
resp.getWriter().println("Quote not found.");
}
}
private final String header =
"<html> " +
"<head> " +
"<meta name=\"robots\" content=\"noindex, nofollow\" /> " +
"<title>Quotes fra #linux.no på freenode</title> " +
"<style type=\"text/css\"> " +
"body {font-family: monospace;}" +
"hr {" +
" border-style: solid;" +
" border-color: black;" +
" border-width: 1px; " +
"}" +
"</style> " +
"</head> " +
"<script src=\"/vote.js\"></script>" +
"<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\"> ";
}
|