<%@ page import="java.util.*" %> <%@ page import="java.util.zip.*" %> <%@ page import="java.io.*" %> <%@ page import="java.lang.*" %> <%@ page import="java.net.*" %> <%@ page import="com.meterware.httpunit.*" %> <%! public String getMyPage(String myAddress){ String fPath="/home/httpd/vhosts/datacorner.com/httpdocs/temp/"; StringBuffer sBuf=new StringBuffer(); String pBody="dummy"; boolean success=false; try { //BufferedWriter lineOut = new BufferedWriter(fwOut); // set up to read the page URL myURL=new URL(myAddress ); BufferedReader in = new BufferedReader(new InputStreamReader(myURL.openStream())); String inputLine=""; success=true; while (success==true) { inputLine = in.readLine(); if (inputLine==null) break; sBuf.append(inputLine); } in.close(); pBody=new String(sBuf); } catch (Exception e) { pBody="--IOException in getMyUrlBytes "+e.toString()+" for "+myAddress; } return pBody; } %> <% String myAddress=""; String[] argSet1=null; String pBody=""; if ((argSet1=request.getParameterValues("myurl"))!=null){ myAddress=argSet1[0]; myAddress=URLDecoder.decode(myAddress); Date myTime1=new Date(); pBody=getMyPage(myAddress); Date myTime2=new Date(); long lTime=myTime2.getTime()-myTime1.getTime(); try{ Long test=new Long(lTime); } catch (Exception e){ lTime=-1; } out.print(pBody.length()+","+lTime); } else out.print("useage: doGetTime.jsp?myurl=http://theUrl
"); %>