private String prepareString(String s)
{
if(s == null)
return null;
if(s.length() < 2)
return s;
if(s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') file://假如字符串s以"开头,又以"结尾,则把两头的"去掉
return s.substring(1, s.length() - 1);
if(s.startsWith("'") && s.endsWith("'"))//假如字符串s以'开头,又以'结尾,则把两头的"去掉
return s.substring(1, s.length() - 1);
else
return s;
}
private boolean processLine1(String s, String s1, String s2, String s3)
{ file://创建一个Object类的实例
Object obj[] = {
null, null
};
Class class1;
if((class1 = (Class)cls.get(s1)) == null)
try
{
class1 = Class.forName(s1);//返回具有s1指定的类名的类的Class描述符
cls.put(s1, class1); file://放回哈西表
}
catch(Exception _ex)
{
System.out.println("不能装载类 " + s1);
return false;
}
obj[0] = class1;
if(s2.length() == 0)
{
try
{
obj[1] = class1.newInstance();// 创建类的新实例
}
catch(NoSUChMethodError _ex)
{
System.out.println("不能创建对象的实例 " + s3);
return false;
}
catch(Exception _ex)
{
System.out.println("不能创建对象的实例 " + s3);
return false;
}
inst.put(s, ((Object) (obj)));
}
else
{
Object obj1[] = getParamArray(s2, 0); file://取得参数列表
if(obj1 == null)
{
System.out.println("不能处理这行参数: " + s3);
return false;
}
try
{
Constructor cons = class1.getConstructor((Class[])obj1[0]);//使用参数列表构建类构建器
if(class1 == null)
{
System.out.println("不能创建对象的实例 " + s3);
return false;
}
obj[1] = cons.newInstance((Object[])obj1[1]);
inst.put(s, ((Object) (obj)));
}
catch(Exception _ex)
{
System.out.println("不能创建对象的实例 " + s3);
return false;
}
}
return true;
}
private Object[] getParamArray(String s, int i) file://取得s中所包含的参数列表,存入一个Object数组中
{
String s1 = s.trim(); file://去除末尾的空格
String s6 = ",";
Vector vector = new Vector();
if(s1.length() > 0)
{
if(s1.charAt(0) == '(')//去掉(
s1 = s1.substring(1);
if(s1.endsWith(")"))//去掉)
s1 = s1.substring(0, s1.length() - 1);
String s2 = s1.trim(); file://去掉字符串后的空格
if(s2.length() == 0 && i == 0) file://假如s2长度为零,说明没有参数
return null;
String s4;
if(s2.length() > 0)
{
if(s2.charAt(0) == '"')//假如s2以"开头,则用\"代替
s6 = "\"";
else
if(s2.charAt(0) == '\'')//假如s2以\'开头,则用'代替
s6 = "'";
else
s6 = ",";
s4 = s2.substring(0, 1); file://取得s2的第一个字符
s2 = s2.substring(1);//取得s2的第二个字符往后的字符
}
else
{
s4 = "";
}
for(; s2.length() > 0; s2 = s2.substring(1))//这些语句是为了把参数表中的参数分离出来
{
String s5 = s2.substring(0, 1);//取得s2的第一个字符
if(s5.equals(s6)) file://假如s5和s6相等,即判定s5是否为两个参数的分隔符
{
if(s6.equals("\"") s6.equals("'"))//假如s6为\"或',则
s4 = s4 + s6;
vector.addElement(s4); file://把s4(即一个参数值)加入vector中
s2 = s2.substring(1).trim();
s4 = "";
if(s2.length() == 0)
break;
s4 = s2.substring(0, 1);
if(s4.charAt(0) == ',')
file://假如s4以","开头,则判定s4是否以分隔符开头
{
s2 = s2.substring(1).trim();
s4 = "";
if(s2.length() == 0)
break;
s4 = s2.substring(0, 1);
}
if(s4.charAt(0) == '"')
s6 = "\"";
else
if(s4.charAt(0) == '\'')
s6 = "'";
else
s6 = ",";
}
else
{
s4 = s4 + s5;
}
}
if(s4.length() > 0)
vector.addElement(s4);
}
int j = vector.size(); file://取得向量变量vector的大小,vector中保存的都是参数值
if(j == 0 && i == 0)
return null; file://没有参数
Object aobj[] = new Object[3];
Class class1[] = new Class[j + i];
Object aobj1[] = new Object[j + i];
aobj[0] = class1;
aobj[1] = ((Object) (aobj1));
aobj[2] = new Integer(j + i);
for(int k = i; k < j + i; k++)
{
String s3 = (String)vector.elementAt(k - i);
try
file://以下的代码是为了判定,每个参数到底是什么数据类型
{ file://判定是否为整型
Integer integer = Integer.valueOf(s3);
class1[k] = Integer.TYPE;
aobj1[k] = integer;
}
catch(Exception _ex)
{
try
{ file://判定是否为浮点型
Float float1 = Float.valueOf(s3);
class1[k] = Float.TYPE;
aobj1[k] = float1;
}
catch(Exception _ex2)
{ file://判定是否为布尔类型
s3 = prepareString(s3);
if(s3.equals("true")) file://判定是否为真
{
class1[k] = Boolean.TYPE;
aobj1[k] = new Boolean(true);
}
else
if(s3.equals("false")) file://判定是否为假
{
class1[k] = Boolean.TYPE;
aobj1[k] = new Boolean(false);
}
else
{
class1[k] = class$Java$lang$String == null ? (class$java$lang$String = class$("java.lang.String")) : class$java$lang$String;
aobj1[k] = s3;
}
}
}
}
vector = null;
return aobj;
}
public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
doGet(httpservletrequest, httpservletresponse);
}
public void doGet(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
throws ServletException, IOException
{
String s = "";
String s1 = "";
s = HttpUtils.getRequestURL(httpservletrequest).toString();
file://返回一个字符串,包含请求字符串中包含的协议名,主机名,端口号以及路径,但是不包含请求的内容
int i;
if((i = s.indexOf("?")) > 0)//去掉s结尾的问号
s = s.substring(0, i);
s1 = httpservletrequest.getQueryString();//取的请求字符串的请求内容
if(s1 == null)
{
parseFile(s1, httpservletrequest, httpservletresponse);
return;
}
if(s1.equals(admin)) file://假如请求串等于admin
{
adminPage(httpservletrequest, httpservletresponse, s); file://进入治理员界面
return;
}
if(s1.equals("namiotde")) file://假如请求串为namiotde,则执行相应的执行命令
{
executeRequest(httpservletrequest, httpservletresponse);
return;
}
String s2 = getFromQuery(s1, "what="); file://取的动作的属性值
if(s2.equals("hframe"))
{
getHiddenFrame(httpservletrequest, httpservletresponse);//转到隐藏帧
return;
}
if(s2.equals("mframe"))
{
getMainFrame(s1, httpservletrequest, httpservletresponse); file://转到主帧
return;
}
else
{
parseFile(s1, httpservletrequest, httpservletresponse);
return;
}
}
file://治理员界面,执行添加删除对象的操作
private void adminPage(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse, String s)
throws IOException
{
PrintWriter printwriter = httpservletresponse.getWriter();
String s1 = "";
String s4 = httpservletrequest.getParameter("what"); file://返回请求串中what,即动作的属性值
if(s4 != null)
if(s4.equals("delete")) file://假如what的值为delete,则执行相应的操作
{
for(Enumeration enumeration = httpservletr