String contentType = req.getContentType();
res.setContentType(contentType);
PrintWriter out = res.getWriter();
// Fetch the page we're on.
String uri = req.getRequestURI();
// Get and increment the count
int count = incrementAndGetCount(uri);
// Prepare to read the input
BufferedReader reader = req.getReader();
String line = null;
while ((line = reader.readLine()) != null) {
line = replace(line, "<COUNT>", "" + count); // case sensitive
out.println(line);
}