System.err.println("DEBUG: uri="+uri);
	public void doGet(HttpServletRequest req, HttpServletResponse resp)	throws IOException, ServletException {		String uri = getRequestURI(req);		String contentType = getContentType(uri);		String type = contentType.replaceAll("^.*/", "");		boolean debug = req.getParameter(P_DEBUG) != null;		String userAgent = getUserAgent(req);		Map<String,String> macros = parseUserAgent(userAgent);		String browserType = getMacroNames(macros.keySet());		System.err.println("DEBUG: browserType="+browserType);		// generate buffer		Map<String,String> buffers = cache.get(browserType);		String buffer = buffers != null && !debug ? buffers.get(uri) : null;		if (buffer == null) {			System.err.println("DEBUG: generating buffer");			buffer = generate(req, macros, type);			if (!debug) {				if (buffers == null) {					buffers = new HashMap<String,String>();					cache.put(browserType, buffers);				}				buffers.put(uri, buffer);			}		}		else {			System.err.println("DEBUG: using previous buffer");		}		// write buffer		try {		 	resp.setContentType(contentType);			resp.setContentLength(buffer.length());		}		catch (IllegalStateException e) {			// ignore -- thrown if called from including JSP		}		try {			OutputStream out = resp.getOutputStream();			byte[] bytes = buffer.getBytes("UTF-8");			out.write(bytes);		}		catch (IllegalStateException e) {			// use writer if called from including JSP			PrintWriter out = resp.getWriter();			out.print(buffer);		}	} // doGet(HttpServletRequest,HttpServletResponse)