Hi there,
Can someone please give me an idiots guide to exactly what this JSP file is doing.
I can see that its a store request from the name, and the java seems to be creating some parameters and date stamping then saving them some where but thats about it.. am i on the right track or completely off?
sore_request.jsp :
Code:<%@ page language="java" import="java.util.*,java.text.*, java.io.*" contentType="text/html; charset=UTF-8" %><% response.setHeader("Cache-Control","no-store"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires", 0); //prevents caching at the proxy server %> <html> <head> <title>store request</title> </head> <body> x <% Properties prop = new Properties(); Enumeration pars = request.getParameterNames(); while (pars.hasMoreElements()) { String par = (String) pars.nextElement(); prop.setProperty (par,request.getParameter(par) + '\n'); } // Format the current time. SimpleDateFormat formatter = new SimpleDateFormat ("dd_MM_yyyy HH:mm:ss"); formatter.setTimeZone(TimeZone.getTimeZone("Greenwich")) ; String dateString = formatter.format(new GregorianCalendar(TimeZone.getTimeZone("Greenwich")).getTime()); prop.setProperty("request_time", dateString + '\n'); prop.remove("Submit"); // Submit value is the text on the submit button, // does not need to be shown. String message = prop.toString(); SimpleDateFormat OSformatter = new SimpleDateFormat ("yyyyMMddHHmmss"); OSformatter.setTimeZone(TimeZone.getTimeZone("Greenwich")) ; String OSdateString = OSformatter.format(new GregorianCalendar(TimeZone.getTimeZone("Greenwich")).getTime()); FileOutputStream outFile = new FileOutputStream("/var/log/stored_request/" + OSdateString + ".log", true); DataOutputStream outStream = new DataOutputStream(outFile); outStream.writeBytes(message + "\n\n"); outStream.close(); outFile.close(); %> </body> </html>


Reply With Quote


Bookmarks