Article View: cn.bbs.comp.lang.java
Article #12004baidu��START NNR Site CensusԴ����
From: 00SK^����
Date: Sat, 14 Aug 2004 01:15
Date: Sat, 14 Aug 2004 01:15
267 lines
8730 bytes
8730 bytes
�����������baidu�ŷ����и�applet������
// v51.java
import java.applet.Applet;
import java.awt.Color;
import java.awt.Component;
import java.io.*;
import java.net.*;
public class v51 extends Applet
{
public void init()
{
startTime = System.currentTimeMillis();
recordTime = true;
if(!initCalled)
{
String s = getParameter("bg");
if(s != null && s.startsWith("#"))
rsBG = s.substring(1);
if(rsBG != null)
{
int i = Integer.parseInt(rsBG, 16);
setBackground(new Color(i));
}
URL url = getCodeBase();
String s1 = new String(url.toString());
cgiRecord = s1 + "cgi-bin/m";
s = getParameter("ci");
if(s != null)
rsCI = s;
s = getParameter("cg");
if(s != null)
rsCG = s;
s = getParameter("si");
if(s == null)
{
URL url1 = getDocumentBase();
s = URLEncoder.encode(new String(url1.toString()));
}
rsSI = s;
s = getParameter("rp");
if(s != null)
rsRP = s;
rsOV = URLEncoder.encode(System.getProperty("os.name") + ":" +
System.getProperty("os.version") + ":" + System.getProperty("os.arch"));
s = System.getProperty("java.vendor");
if(s.startsWith("Netscape"))
s = "NS";
else
if(s.startsWith("Microsoft"))
s = "MS";
String s2 = System.getProperty("java.version");
if(s2.startsWith("1.0.") && s.startsWith("Apple"))
appleJvProblem = true;
if(s.startsWith("Apple") && s2.startsWith("1.1.") && !
s2.startsWith("1.1.7") && !s2.startsWith("1.1.8") && !s2.startsWith("1.1.9"))
appleJvProblem = true;
if(appleJvProblem)
{
System.out.println("IMPORTANT: Please Upgrade your MRJ to the
latest version from http://www.apple.com/java");
return;
}
rsJV = URLEncoder.encode(s2);
s = getParameter("sr");
if(s != null)
rsSR = s;
s = getParameter("cd");
if(s != null)
rsCD = s;
s = getParameter("lg");
if(s != null)
rsLG = s;
s = getParameter("je");
if(s != null)
rsJE = s;
s = getParameter("ck");
if(s != null)
rsCK = s;
s = getParameter("tz");
if(s != null)
rsTZ = s;
s = getParameter("ct");
if(s != null)
rsCT = s;
s = getParameter("hp");
if(s != null)
rsHP = s;
s = getParameter("tl");
if(s != null)
rsTL = s;
s = getParameter("do");
if(s != null)
rsDO = (new Integer(s)).intValue();
initCalled = true;
}
if(rsDO > 0)
System.out.println("D> Init Applet");
}
public void start()
{
if(rsDO > 0)
System.out.println("D> Start Applet");
if(appleJvProblem)
{
if(rsDO > 0)
System.out.println("D> Apple JVM Problem");
return;
}
if(recordTime)
recordTime = false;
else
startTime = System.currentTimeMillis();
timeout = false;
sleepThread = new v51Sleep(this, ONE_SECOND * MAXIMUM_PAGE_DURATION);
sleepThread.start();
}
public void wakeUp()
{
if(rsDO > 0)
System.out.println("D> Wakeup called by v51Sleep");
fromSleepThread = true;
stop();
timeout = true;
}
public void stop()
{
if(appleJvProblem)
return;
if(timeout)
{
if(rsDO > 0)
System.out.println("D> Already posted when timeout - NOOP");
return;
}
stopTime = System.currentTimeMillis();
rsDU = stopTime - startTime;
rsDU = (rsDU + 500L) / 1000L;
if(rsDU > MAXIMUM_PAGE_DURATION)
rsDU = MAXIMUM_PAGE_DURATION;
else
if(rsDU < 0L)
rsDU = 0L;
if(!fromSleepThread && sleepThread != null)
{
sleepThread.stop();
sleepThread = null;
}
fromSleepThread = false;
try
{
cgiRecord = cgiRecord + "?ci=" + rsCI;
cgiRecord = cgiRecord + "&cg=" + rsCG;
cgiRecord = cgiRecord + "&du=" + String.valueOf(rsDU);
cgiRecord = cgiRecord + "&si=" + rsSI;
cgiRecord = cgiRecord + "&rp=" + rsRP;
cgiRecord = cgiRecord + "&ov=" + rsOV;
cgiRecord = cgiRecord + "&jv=" + rsJV;
cgiRecord = cgiRecord + "&tl=" + rsTL;
cgiRecord = cgiRecord + "&sr=" + rsSR;
cgiRecord = cgiRecord + "&lg=" + rsLG;
cgiRecord = cgiRecord + "&je=" + rsJE;
cgiRecord = cgiRecord + "&ck=" + rsCK;
cgiRecord = cgiRecord + "&tz=" + rsTZ;
cgiRecord = cgiRecord + "&ct=" + rsCT;
cgiRecord = cgiRecord + "&hp=" + rsHP;
cgiRecord = cgiRecord + "&cd=" + rsCD;
cgiRecord = cgiRecord + "&li=" + rsLI;
if(rsDO > 0)
System.out.println("D> Post record to url " + cgiRecord);
URL url = new URL(cgiRecord);
URLConnection urlconnection = url.openConnection();
urlconnection.setDoOutput(true);
urlconnection.setRequestProperty("Content-Type", "application/x-
www-form-urlencoded");
urlconnection.setUseCaches(false);
java.io.InputStream inputstream = urlconnection.getInputStream();
DataInputStream datainputstream = new DataInputStream
(inputstream);
String s;
if(rsDO > 0)
while((s = datainputstream.readLine()) != null)
System.out.println(s);
datainputstream.close();
if(rsDO > 0)
{
System.out.println("D> Applet Stop");
return;
}
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
public v51()
{
ONE_SECOND = 1000L;
MAXIMUM_PAGE_DURATION = 1800L;
recordTime = false;
timeout = false;
fromSleepThread = false;
appleJvProblem = false;
initCalled = false;
rsCI = "";
rsCG = "";
rsRP = "";
rsSI = "";
rsSR = "";
rsCD = "";
rsLG = "";
rsJE = "";
rsCK = "";
rsTZ = "";
rsCT = "";
rsHP = "";
rsTL = "";
rsEF = "";
rsOV = "";
rsJV = "";
rsLI = "";
rsBG = "FFFFFF";
}
long ONE_SECOND;
long MAXIMUM_PAGE_DURATION;
String cgiRecord;
long startTime;
long stopTime;
boolean recordTime;
boolean timeout;
boolean fromSleepThread;
boolean appleJvProblem;
boolean initCalled;
v51Sleep sleepThread;
long rsDU;
String rsCI;
String rsCG;
String rsRP;
String rsSI;
String rsSR;
String rsCD;
String rsLG;
String rsJE;
String rsCK;
String rsTZ;
String rsCT;
String rsHP;
String rsTL;
String rsEF;
String rsOV;
String rsJV;
String rsLI;
String rsBG;
int rsDO;
}
--
ʲô���̣�����Ҫ�ڱ�����ͷ��ѵ�
�й���Ӧ�þ������еĵ�
[1;34m�� ��Դ:���Ұ��Ͽ�վ nkbbs.org ��Web[FROM: 61.50.158.99][m
Technical Details
Message-ID:
<4Dc7kK$9eI@bbs.nankai.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.neu.edu.cn!news2.happynet.org!NanKaiShow Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,1c5d57d47aaffd65,start X-Google-Attributes: gidf6cb0,public X-Google-Language: ENGLISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.neu.edu.cn!news2.happynet.org!NanKai From: rj.bbs@bbs.nankai.edu.cn (00SK^����) Newsgroups: cn.bbs.comp.lang.java Subject: baidu��START NNR Site CensusԴ���� Date: 14 Aug 2004 01:15:32 GMT Organization: �Ұ��Ͽ�վ Message-ID: <4Dc7kK$9eI@bbs.nankai.edu.cn> X-Filename: Java/M.1092446132.A Lines: 267