/** * Output the body information. */ private static void outputBody(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException { // Get the body size int leng = req.getContentLength(); // Do nothing if there is no body if (leng <= 0) return; // Buffer to read byte rbuf[] = new byte[leng]; // Put data InputStream in = req.getInputStream(); if (in.read(rbuf, 0, leng) > 0) { // Output data outputBinary(fw, rbuf); } }
outputHeaders(fw, req); outputBody(fw, req);
/** * Display the request header. */ private static void outputHeaders(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException { // Get the header Enumeration reqHeaderNum = req.getHeaderNames(); // Do nothing if there is no header if (reqHeaderNum == null) { fw.write("No headers" + "\n"); return; } // Repeat the header element while (reqHeaderNum.hasMoreElements()) { // Get the key String key = (String) reqHeaderNum.nextElement(); // Output the header information outputHeaderElements(fw, req, key); } }
System.out.println("Exception occurred while processing HTTP request: " + info + ", request details logged in " + HTTPRequestLog.getFileName()); HTTPRequestLog.outputRequest(info, req);
log_errors = HTTPRequestLog.init(getServletContext());
System.out.println("Exception occurred while processing HTTP request: " + info + ", request details logged in " + HTTPRequestLog.getFileName()); HTTPRequestLog.outputRequest(info, req);
log_errors = HTTPRequestLog.init(getServletContext());
outputHeaders(fw, req); outputBody(fw, req);
/** * Output the body information. */ private static void outputBody(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException { // Get the body size int leng = req.getContentLength(); // Do nothing if there is no body if (leng <= 0) return; // Buffer to read byte rbuf[] = new byte[leng]; // Put data InputStream in = req.getInputStream(); if (in.read(rbuf, 0, leng) > 0) { // Output data outputBinary(fw, rbuf); } }
/** * Display the request header. */ private static void outputHeaders(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException { // Get the header Enumeration reqHeaderNum = req.getHeaderNames(); // Do nothing if there is no header if (reqHeaderNum == null) { fw.write("No headers" + "\n"); return; } // Repeat the header element while (reqHeaderNum.hasMoreElements()) { // Get the key String key = (String) reqHeaderNum.nextElement(); // Output the header information outputHeaderElements(fw, req, key); } }