jsp探针
在网上找到一些jsp探针,收藏下。
JSP探针1.jsp
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.lang.*" %>
<%
long timePageStart = System.currentTimeMillis();
%>
<%
class EnvServlet
{
public long timeUse=0;
public Hashtable htParam=new Hashtable();
private Hashtable htShowMsg=new Hashtable();
public void setHashtable()
{
Properties me=System.getProperties();
Enumeration em=me.propertyNames();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=me.getProperty(strKey);
htParam.put(strKey,strValue);
}
}
public void getHashtable(String strQuery)
{
Enumeration em=htParam.keys();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=new String();
if(strKey.indexOf(strQuery,0)>=0)
{
strValue=(String)htParam.get(strKey);
htShowMsg.put(strKey,strValue);
}
}
}
public String queryHashtable(String strKey)
{
strKey=(String)htParam.get(strKey);
return strKey;
}
public long test_int()
{
long timeStart = System.currentTimeMillis();
int i=0;
while(i<3000000)i++;
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
public long test_sqrt()
{
long timeStart = System.currentTimeMillis();
int i=0;
double db=(double)new Random().nextInt(1000);
while(i<200000){db=Math.sqrt(db);i++;}
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
}
%>
<%
EnvServlet env=new EnvServlet();
env.setHashtable();
String action=new String(" ");
String act=new String("action");
if(request.getQueryString()!=null&&request.getQueryString().indexOf(act,0)>=0)action=request.getParameter(act);
%>
<html>
<head>
<title>JSP 探针</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
A { COLOR: #000000; TEXT-DECORATION: none}
A:hover { COLOR: #f58200}
body,td,span { font-size: 9pt}
.input { BACKGROUND-COLOR: #ffffff;BORDER:#f58200 1px solid;FONT-SIZE: 9pt}
.backc { BACKGROUND-COLOR: #f58200;BORDER:#f58200 1px solid;FONT-SIZE: 9pt;color:white}
.PicBar { background-color: #f58200; border: 1px solid #000000; height: 12px;}
.tableBorder {BORDER-RIGHT: #183789 1px solid; BORDER-TOP: #183789 1px solid; BORDER-LEFT: #183789 1px solid; BORDER-BOTTOM: #183789 1px solid; BACKGROUND-COLOR: #ffffff; WIDTH: 760;}
.divcenter {
position:absolute;
height:30px;
z-index:1000;
left: 101px;
top: 993px;
}
</STYLE>
<script language="javascript">
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
eval("txt" + sid + ".innerHTML=\"<a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a>\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
eval("txt" + sid + ".innerHTML=\"<a href='#' title='打开此项'><font face='Wingdings' color=#FFFFFF>y</font></a>\";");
}
}
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0">
<CENTER>
<table width="760" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%"><P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: -8px"> <STRONG
style="FONT-SIZE: 40pt">JSP探针</STRONG></td>
<td width="70%" align="center"><font color=red>欢迎访问<a href="http://free3.e-168.cn/cnforum/">JSP智库</a>,下载最新版程序<br>
<a href="http://free3.e-168.cn/cnforum/jspenv.rar">直接下载最新版本</font></a></td>
</tr>
</table>
选项:<a href="#ServerInfo">服务器相关参数</a> | <a href="#JAVAInfo">JAVA相关参数</a> | <a href="#Paramter">参数查询</a> | <a href="#ServerAbility">服务器运算能力</a>
| <a href="#ISpeedTest">服务器连接速度</a>
| <a href="javascript:location.reload()">刷新</a><a name="ServerInfo"></a>
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(0)"><font color=#FFFFFF><strong>服务器相关参数</strong></font> <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt0 name=txt0><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span>
</td>
</tr>
<tr>
<td style="display" id='submenu0'><table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#FFFFFF" height="22">
<td width="130"> 服务器名</td>
<td colspan="3" height="22"> <%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 服务器操作系统</td>
<td colspan="3"> <%=env.queryHashtable("os.name")%> <%=env.queryHashtable("os.version")%>
<%=env.queryHashtable("sun.os.patch.level")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 服务器操作系统类型</td>
<td> <%=env.queryHashtable("os.arch")%></td>
<td> 服务器操作系统模式</td>
<td> <%=env.queryHashtable("sun.arch.data.model")%>位</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 服务器所在地区</td>
<td> <%=env.queryHashtable("user.country")%></td>
<td> 服务器语言</td>
<td> <%=env.queryHashtable("user.language")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 服务器时区</td>
<td> <%=env.queryHashtable("user.timezone")%></td>
<td> 服务器时间</td>
<td> <%=new java.util.Date()%> </td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 服务器解译引擎</td>
<td width="170"> <%= getServletContext().getServerInfo() %></td>
<td width="130"> 服务器端口</td>
<td width="170"> <%= request.getServerPort() %></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td height="22"> 当前用户</td>
<td height="22" colspan="3"> <%=env.queryHashtable("user.name")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td> 用户目录</td>
<td colspan="3"> <%=env.queryHashtable("user.dir")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=left bgcolor="#FFFFFF"> 本文件实际路径</td>
<td height="8" colspan="3" bgcolor="#FFFFFF"> <%=request.getRealPath(request.getServletPath())%></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="JAVAInfo" id="JAVAInfo"></a><br>
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(1)"><font color=#FFFFFF><strong>JAVA相关参数</strong></font>
<a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a>
<span id=txt1 name=txt1><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span>
</td>
</tr>
<tr>
<td style="display" id='submenu1'>
<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#fcc79b" height="22">
<td width="30%"> 名称</td>
<td width="50%" height="22"> 英文名称</td>
<td width="20%" height="22"> 版本</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> JAVA运行环境名称</td>
<td width="50%" height="22"> <%=env.queryHashtable("java.runtime.name")%></td>
<td width="20%" height="22"> <%=env.queryHashtable("java.runtime.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> JAVA运行环境说明书名称</td>
<td width="50%" height="22"> <%=env.queryHashtable("java.specification.name")%></td>
<td width="20%" height="22"> <%=env.queryHashtable("java.specification.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> JAVA虚拟机名称</td>
<td width="50%" height="22"> <%=env.queryHashtable("java.vm.name")%></td>
<td width="20%" height="22"> <%=env.queryHashtable("java.vm.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> JAVA虚拟机说明书名称</td>
<td width="50%" height="22"> <%=env.queryHashtable("java.vm.specification.name")%></td>
<td width="20%" height="22"> <%=env.queryHashtable("java.vm.specification.version")%></td>
</tr>
<%
float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
float fPercent=fFreeMemory/fTotalMemory*100;
%>
<tr bgcolor="#FFFFFF" height="22">
<td height="22"> JAVA虚拟机剩余内存:</td>
<td height="22" colspan="2"><img align=absmiddle class=PicBar width='<%=0.85*fPercent%>%'> <%=fFreeMemory/1024/1024%>M
</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td height="22"> JAVA虚拟机分配内存</td>
<td height="22" colspan="2"><img align=absmiddle class=PicBar width='85%'> <%=fTotalMemory/1024/1024%>M
</td>
</tr>
</table>
<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#fcc79b" height="22">
<td width="30%"> 参数名称</td>
<td width="70%" height="22"> 参数路径</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> java.class.path </td>
<td width="70%" height="22"> <%=env.queryHashtable("java.class.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br> ")%>
</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> java.home</td>
<td width="70%" height="22"> <%=env.queryHashtable("java.home")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> java.endorsed.dirs</td>
<td width="70%" height="22"> <%=env.queryHashtable("java.endorsed.dirs")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> java.library.path</td>
<td width="70%" height="22"> <%=env.queryHashtable("java.library.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br> ")%>
</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%"> java.io.tmpdir</td>
<td width="70%" height="22"> <%=env.queryHashtable("java.io.tmpdir")%></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="Paramter" id="Paramter"></a><br>
<form action="?action=query" method="post" name="queryform">
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(2)"><font color=#FFFFFF><strong>参数查询</strong></font>
<a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a>
<span id=txt2 name=txt2><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span>
</td>
</tr>
<tr>
<td style="display" id='submenu2'>
<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#fcc79b" height="22">
<td> 请查询系统的参数信息(<a href="#" onClick="document.queryform.submit()">枚举所有参数信息</a>)</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=center>
<input type="text" name="query" class="input" size="70">
<input type="submit" value="提交" class="backc">
<input type="reset" value="重置" class="backc"> </td>
</tr>
</table>
<table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<%
if(action.equals("query"))
{
String query=request.getParameter("query");
env.getHashtable(query);
if(env.htShowMsg.size()>0)
out.println("<tr bgcolor=\"#fcc79b\" height=\"22\">\n<td> 参数名称</td>\n<td> 参数信息</td>\n</tr>");
else
out.println("<tr bgcolor=\"#fcc79b\" height=\"22\">\n<td> <font color=red>出错信息:</font></td>\n<td> <font color=red>没有找到你所查询的内容,请输入所要查询的参数,如果不确认,可以进行抽象查询,输入所包含字母。</font></td>\n</tr>");
Enumeration em=env.htShowMsg.keys();
while(em.hasMoreElements())
{
String strParam=(String)em.nextElement();
String strParamValue=(String)env.htShowMsg.get(strParam);
if(strParam.indexOf(".path",0)>=0){strParamValue=strParamValue.replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br> ");}
out.println ("<tr bgcolor=\"#FFFFFF\" height=\"22\"><td width=\"30%\"> "+strParam+"</td><td width=\"70%\"> "+strParamValue+"</td></tr>");
}
}
%>
</table>
</td>
</tr>
</table>
</form>
<a name="ServerAbility" id="ServerAbility"></a>
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(3)"><font color=#FFFFFF><strong>服务器运算能力</strong></font>
<a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a>
<span id=txt3 name=txt3><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span>
</td>
</tr>
<tr>
<td style="display" id='submenu3'> <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#fcc79b" height="22">
<td colspan="3"> <font face='Webdings'>4</font> 让服务器执行300万次加法(<font color="#000000">整数运算</font>)和20万次开方(浮点运算),记录其所使用的时间。
</td>
</tr>
<tr height="22"bgcolor="#FFFFFF" >
<td align=center bgcolor="#FFFFFF"><font color="#000000">可 供 参 考 的
服 务 器 列 表</font></td>
<td align="center">整数运算</td>
<td align="center">浮点运算</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=left> 公司的电脑 (CPU:Celeron 1G 内存:256M)</td>
<td align="center">60 毫秒</td>
<td align="center">70 毫秒</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=left> 家里的电脑 (CPU:Duron 1G 内存:384M) </td>
<td align="center">20 毫秒</td>
<td align="center">10 毫秒</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=left> <a href="http://free3.e-168.cn/cnforum/jspenv.jsp" target="_blank">中国网聚服务器
(CPU:Intel Pentium III 1G 内存:768M)</a></td>
<td align="center">20 毫秒</td>
<td align="center">3 毫秒</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td align=left> <a href="http://ibmclub.hust.edu.cn/myweb/ggyy/jspenv.jsp" target="_blank">IBM俱乐部
(CPU:IIntel(R) Celeron(R) CPU 1.70G 内存:256M)</a></td>
<td align="center">3 毫秒 </td>
<td align="center">7 毫秒</td>
</tr>
<tr bgcolor="#FFFFFF" height=25>
<td align=left> <font color=red>您正在使用的这台服务器</font> <INPUT name="button2" type="button" class=backc onclick="javascript:location.reload()" value="重新测试">
</td>
<td align="center"><font color=red><%=env.test_int()%> 毫秒</font></td>
<td align="center"><font color=red><%=env.test_sqrt()%> 毫秒</font></td>
</tr>
</table></td>
</tr>
</table>
<a name="ISpeedTest" id="ISpeedTest"></a><br>
<%
if(action.equals("SpeedTest"))
{
%>
<div id="testspeed" align="center">
<table width="200" border="0" cellspacing="0" cellpadding="0" class="divcenter">
<tr>
<td height="30" align=center><p><font color="#000000"><span id=txt5>网速测试中,请稍候...</span></font></p></td>
</tr>
</table>
</div>
<%}%> <table border="0" cellpadding="0" cellspacing="1" bgcolor="#f58200" class="tableBorder">
<tr>
<td height="25" align="center" bgcolor="#f58200" onclick="showsubmenu(4)"><font color="#FFFFFF"><strong>服务器连接速度</strong></font> <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt4 name=txt4><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> </td>
</tr>
<tr>
<td bgcolor="#F8F9FC" style="display" id='submenu4'> <table width="100%" border="0" cellspacing=1 cellpadding=3 bgcolor="#f58200">
<tr bgcolor="#FFFFFF">
<td width="80">接入设备</td>
<td width="420"> 连接速度(理想值)</td>
<td width="100">下载速度(理想值)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>56k Modem</td>
<td><img align=absmiddle class=PicBar width='1%'> 56 Kbps</td><td> 7.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>64k ISDN</td>
<td><img align=absmiddle class=PicBar width='1%'> 64 Kbps</td><td> 8.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>512k ADSL</td>
<td><img align=absmiddle class=PicBar width='5%'> 512 Kbps</td><td> 64.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="19">1.5M Cable</td>
<td><img align=absmiddle class=PicBar width='15%'> 1500 Kbps</td><td> 187.5 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>5M FTTP</td>
<td><img align=absmiddle class=PicBar width='50%'> 5000 Kbps</td><td> 625.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>当前连接速度</td>
<%
if(action.equals("SpeedTest"))
{
out.println("<script language='JavaScript'>var tSpeedStart=new Date();</script>") ;
out.println("<!--\n");
for(int i=0;i<1000;i++)
{out.println("####################################################################################################");}
out.println("-->\n");
out.println("<script language='JavaScript'>var tSpeedEnd=new Date();</script>\n");
out.println("<script language='JavaScript'>");
out.println("var iSpeedTime=0;iSpeedTime=(tSpeedEnd - tSpeedStart) / 1000;");
out.println("if(iSpeedTime>0) iKbps=Math.round(Math.round(100 * 8 / iSpeedTime * 10.5) / 10); else iKbps=10000 ;");
out.println("var iShowPer=Math.round(iKbps / 100);");
out.println("if(iShowPer<1) iShowPer=1; else if(iShowPer>82) iShowPer=82;");
out.println("</script>\n");
out.println("<script language='JavaScript'>") ;
out.println("document.write('<td><img align=absmiddle class=PicBar width=\"' + iShowPer + '%\">' + iKbps + ' Kbps');");
out.println("</script>\n");
out.println("</td><td> <a href='?action=SpeedTest' title=测试连接速度><u>");
out.println("<script language='JavaScript'>");
out.println("document.write(Math.round(iKbps/8*10)/10+ ' k/s');");
out.println("</script>\n") ;
out.println("</u></a></td>");
%>
<script>
txt5.innerHTML="网速测试完毕!"
testspeed.style.visibility="hidden"
</script>
<%
}
else
{out.println("<td></td><td> <a href='?action=SpeedTest' title=测试连接速度><u>开始测试</u></a></td>");}
%>
</tr>
</table></td>
</tr>
</table>
<%
long timePageEnd = System.currentTimeMillis();
long timePageUse=timePageEnd-timePageStart;
%>
<table border=0 cellpadding=0 cellspacing=1 class=tableBorder>
<tr>
<td height="59" align=center>
页面执行时间:约<%=timePageUse%>毫秒 JspEnv V1.0</td>
</tr>
</table>
</CENTER>
</body>
</html>
JSP探针2.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<html> <head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE>
BODY{font-size:12px; margin:0px;}
TR{font-size:12px;}
</STYLE>
<title>JSP探针</title>
</head> <body style="margin-left:100px;margin-right:100px;">
<center><img src="http://www.163jsp.com/img/logo/163jsp04.gif" border="0"></center>
<center style="color:#0084d1;font-size:16px;font-weight:bold;">容器信息</center>
<TABLE align="center" WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>
<TR>
<TD width=100 bgcolor="#FF3300">
<font color="white">容器名称:</font>
</TD>
<TD bgcolor="#008080">
<font color="white"><%=application.getServerInfo() %></font>
</TD>
</TR>
<TR>
<TD width=100 bgcolor="#FF3300">
<font color="white">Servlet规范:</font>
</TD>
<TD bgcolor="#008080">
<font color="white"><%=application.getMajorVersion() %>.<%=application.getMinorVersion() %></font>
</TD>
</TR>
</TABLE>
<BR>
<center style="color:#0084d1;font-size:16px;font-weight:bold;">系统根目录</center>
<TABLE align="center" WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>
<TR>
<TD align="center">
<%
File[] fs = File.listRoots();
for(int i=0;i<fs.length;i++){
%>
<font color="#FF3300" size="4" FACE="Arial Black, sans-serif"><%=fs[i].getCanonicalPath()%> </font>
<%
}
%>
</TD>
</TR>
</TABLE>
<BR>
<center style="color:#0084d1;font-size:16px;font-weight:bold;">系统参数</center>
<TABLE align="center" WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1> <%
Properties pro = System.getProperties();
Enumeration e = pro.propertyNames();
while(e.hasMoreElements()){
String name = (String)e.nextElement();
String value = pro.getProperty(name);
%>
<TR>
<TD bgcolor="#579d1c">
<font color="white"><%=name%></font>
</TD>
<TD bgcolor="#008080">
<font color="white"><%=value%></font>
</TD>
</TR>
<%
}
%>
</TABLE>
<BR>
<center style="color:#0084d1;font-size:16px;font-weight:bold;">环境变量</center>
<TABLE align="center" WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>
<%
Map env = System.getenv();
Iterator it = env.keySet().iterator();
while(it.hasNext()){
String name = (String)it.next();
String value= (String)env.get(name);
%>
<TR>
<TD bgcolor="#579d1c">
<font color="white"><%=name%></font>
</TD>
<TD bgcolor="#008080">
<font color="white"><%=value%></font>
</TD>
</TR>
<%
}
%>
</TABLE>
<BR>
<center style="color:#0084d1;font-size:16px;font-weight:bold;">JVM内存</center>
<TABLE align="center" WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>
<TR>
<TD align="center">
<font color="#FF3300" size="4" FACE="Arial Black, sans-serif">
内存总量:<%=Runtime.getRuntime().totalMemory()/1024/1024%>MB
最大内存:<%=Runtime.getRuntime().maxMemory()/1024/1024%>MB
空闲内存:<%=Runtime.getRuntime().freeMemory()/1024/1024%>MB
</font>
</TD>
</TR>
</TABLE>
<BR>
</body> </html>
JSP探针3.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%@page import="java.util.*"%>
<%@page import="java.awt.image.BufferedImage"%>
<%@page import="java.awt.*"%>
<%@page import="java.io.*"%>
<%
/*
程序作者:淘特网
程序出自:http://cms.tot.name
*/
long startTime = System.currentTimeMillis();
long startMem = Runtime.getRuntime().freeMemory();
%>
<%!
public class LibInfo { boolean supportJNDI = false;
boolean supportJavaxSql = false;
boolean supportJAF = false;
boolean supportMail = false; boolean supportBeanUtils = false;
boolean supportCommonLogging = false;
boolean supportCommonCodec = false;
boolean supportCommonCollection = false;
boolean supportCommonDigester = false;
boolean supportCommonLang = false;
boolean supportJakartaRegExp = false;
boolean supportLucene = false; boolean supportDom4j = false; boolean supportMmMysqlDriver = false;
boolean supportComMysqlDriver = false; boolean supportImageProcessing = false; public LibInfo() {
try {
Class.forName("javax.naming.Name");
supportJNDI = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("javax.sql.DataSource");
supportJavaxSql = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("javax.activation.DataSource");
supportJAF = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("javax.mail.Message");
supportMail = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.beanutils.MethodUtils");
supportBeanUtils = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.logging.LogFactory");
supportCommonLogging = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.codec.Decoder");
supportCommonCodec = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.collections.ArrayStack");
supportCommonCollection = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.digester.Digester");
supportCommonDigester = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.commons.lang.SystemUtils");
supportCommonLang = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.regexp.RE");
supportJakartaRegExp = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.apache.lucene.index.IndexWriter");
supportLucene = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.dom4j.Document");
supportDom4j = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("org.gjt.mm.mysql.Driver");
supportMmMysqlDriver = true;
} catch (ClassNotFoundException ex) {} try {
Class.forName("com.mysql.jdbc.Driver");
supportComMysqlDriver = true;
} catch (ClassNotFoundException ex) {} try {
BufferedImage bufferedImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
Graphics2D g = bufferedImage.createGraphics();
g.drawLine(0, 0, 10, 10);
g.dispose();// free resource supportImageProcessing = true;
} catch (Throwable ex) {} } public boolean isSupportJAF() {
return supportJAF;
} public boolean isSupportJavaxSql() {
return supportJavaxSql;
} public boolean isSupportJNDI() {
return supportJNDI;
} public boolean isSupportMail() {
return supportMail;
} public boolean isSupportBeanUtils() {
return supportBeanUtils;
} public boolean isSupportCommonLogging() {
return supportCommonLogging;
} public boolean isSupportCommonCodec() {
return supportCommonCodec;
} public boolean isSupportCommonCollection() {
return supportCommonCollection;
} public boolean isSupportCommonDigester() {
return supportCommonDigester;
} public boolean isSupportCommonLang() {
return supportCommonLang;
} public boolean isSupportJakartaRegExp() {
return supportJakartaRegExp;
} public boolean isSupportLucene() {
return supportLucene;
} public boolean isSupportDom4j() {
return supportDom4j;
} public boolean isSupportMmMysqlDriver() {
return supportMmMysqlDriver;
} public boolean isSupportComMysqlDriver() {
return supportComMysqlDriver;
} public boolean isSupportImageProcessing() {
return supportImageProcessing;
} }
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>淘特JSP探针</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {color: #FFFFFF; font-size:14px; font-weight:bold;}
.line20{line-height:20px;}
.table-header-text { color: #FFFFFF;
font-weight: normal;
margin: 3px 5px 1px 15px;
font-family: Arial, Verdana,Helvetica, Sans-Serif;
}
td{white-space:normal; word-break:break-all;}
-->
</style>
</head> <body>
<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0" bgcolor="#7171A5">
<tr>
<td><div align="center"><span class="style1">淘特JSP探针</span></div></td>
</tr>
</table>
<h3>Request Variables:</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED" class="line20">
<tr>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getAuthType</td>
<td bgcolor="#FFFFFF"> <%=request.getAuthType()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getCharacterEncoding</td>
<td bgcolor="#FFFFFF"> <%=request.getCharacterEncoding()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getContentLength</td>
<td bgcolor="#FFFFFF"> <%=request.getContentLength()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getContentType</td>
<td bgcolor="#FFFFFF"> <%=request.getContentType()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getContextPath</td>
<td bgcolor="#FFFFFF"> <%=request.getContextPath()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getLocale</td>
<td bgcolor="#FFFFFF"> <%=request.getLocale()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getLocales</td>
<td bgcolor="#FFFFFF"> <%=request.getLocales()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getMethod</td>
<td bgcolor="#FFFFFF"> <%=request.getMethod()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getPathInfo</td>
<td bgcolor="#FFFFFF"> <%=request.getPathInfo()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getPathTranslated</td>
<td bgcolor="#FFFFFF"> <%=request.getPathTranslated()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getProtocol</td>
<td bgcolor="#FFFFFF"> <%=request.getProtocol()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getReader</td>
<td bgcolor="#FFFFFF"> <%=request.getReader()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRealPath</td>
<td bgcolor="#FFFFFF"> <%=request.getRealPath(".")%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRemoteAddr</td>
<td bgcolor="#FFFFFF"> <%=request.getRemoteAddr()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRemoteHost</td>
<td bgcolor="#FFFFFF"> <%=request.getRemoteHost()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRemoteUser</td>
<td bgcolor="#FFFFFF"> <%=request.getRemoteUser()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRequestDispatcher</td>
<td bgcolor="#FFFFFF"> <%=request.getRequestDispatcher("/")%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRequestURI</td>
<td bgcolor="#FFFFFF"> <%=request.getRequestURI()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getRequestURL</td>
<td bgcolor="#FFFFFF"> <%=request.getRequestURL()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getServerName</td>
<td bgcolor="#FFFFFF"> <%=request.getServerName()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getServerPort</td>
<td bgcolor="#FFFFFF"> <%=request.getServerPort()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getServletPath</td>
<td bgcolor="#FFFFFF"> <%=request.getServletPath()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> getUserPrincipal</td>
<td bgcolor="#FFFFFF"> <%=request.getUserPrincipal()%></td>
</tr>
</table>
<h3>Session Variables:</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED" class="line20">
<tr>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<%
Enumeration e = session.getAttributeNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
String value = (String)session.getAttribute(name);
%>
<tr>
<td bgcolor="#FFFFFF"> <%=name%></td>
<td bgcolor="#FFFFFF"> <%=value%></td>
</tr>
<%
}
%>
</table>
<h3>Application Variables:</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED" class="line20">
<tr>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<%
e = application.getAttributeNames();
while (e.hasMoreElements()) {
String name = (String)e.nextElement();
%>
<tr>
<td bgcolor="#FFFFFF"> <%=name%></td>
<td bgcolor="#FFFFFF"> <%=application.getAttribute(name)%></td>
</tr>
<%
}
%>
</table> <h3>Cookies Variables:</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED" class="line20">
<tr>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<%
Cookie[] cos=request.getCookies();
if(cos!=null){
for(int i=0;i<cos.length;i++)
{
%>
<tr>
<td bgcolor="#FFFFFF"> <%=cos[i].getName()%></td>
<td bgcolor="#FFFFFF"> <%=cos[i].getValue()%></td>
</tr>
<%
}
}
%>
</table> <h3>Server Variables:</h3>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED" class="line20">
<tr>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td width="50%" height="22" bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<%
Properties props=System.getProperties();
Iterator iter=props.keySet().iterator();
while(iter.hasNext())
{
String key=(String)iter.next();
%>
<tr>
<td bgcolor="#FFFFFF"> <%=key%></td>
<td bgcolor="#FFFFFF"> <%=props.get(key)%></td>
</tr>
<%
}
%>
</table>
<h3>Lib Info</h3>
<%
LibInfo lib=new LibInfo();
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#DEE3ED">
<tr>
<td height="25" bgcolor="#9999CC"><span class="table-header-text">Property </span></td>
<td bgcolor="#9999CC"><span class="table-header-text">Value</span></td>
</tr>
<tr>
<td width="476" bgcolor="#FFFFFF">supportJNDI</td>
<td width="484" bgcolor="#FFFFFF"> <%=lib.isSupportJNDI()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportJavaxSql</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportJavaxSql()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportJAF</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportJAF()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportMail</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportMail()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportBeanUtils</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportBeanUtils()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportCommonLogging</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportCommonLogging()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportCommonCodec</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportCommonCodec()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportCommonCollection</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportCommonCollection()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportCommonDigester</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportCommonDigester()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportCommonLang</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportCommonLang()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportJakartaRegExp</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportJakartaRegExp()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportLucene</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportLucene()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportDom4j</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportDom4j()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportMmMysqlDriver</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportMmMysqlDriver()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportComMysqlDriver</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportComMysqlDriver()%></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">supportImageProcessing</td>
<td bgcolor="#FFFFFF"> <%=lib.isSupportImageProcessing()%></td>
</tr>
</table>
<p><br>
</p>
</body>
</html>
<%
long endMem = Runtime.getRuntime().freeMemory();
long total= Runtime.getRuntime().maxMemory();
out.println("Total Memory:"+total);
out.println("Start Memory:"+startMem);
out.println("End Memory:"+endMem);
out.println("Use memory: "+ (startMem - endMem));
long endTime = System.currentTimeMillis();
out.println("Use Time: "+ (endTime-startTime));
%>
jsp探针的更多相关文章
- JSP环境探针-当前电脑所有系统参数
1 <%@ page contentType="text/html;charset=gb2312" %> <%@ page import="java.u ...
- [Windows Server 2012] Tomcat安全加固方法
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com ★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频. ★ 本节我们将带领大家:Tomca ...
- [Windows Server 2012] Tomcat安装方法
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com ★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频. ★ 本节我们将带领大家:Win20 ...
- myeclipse学习总结一(在MyEclipse中设置生成jsp页面时默认编码为utf-8编码)
1.每次我们在MyEclispe中创建Jsp页面,生成的Jsp页面的默认编码是"ISO-8859-1".在这种情况下,当我们在页面中编写的内容存在中文的时候,就无法进行保存.如下图 ...
- jsp前端实现分页代码
前端需要订一page类包装,其参数为 private Integer pageSize=10; //每页记录条数=10 private Integer totalCount; //总记录条数 priv ...
- jsp中出现onclick函数提示Cannot return from outside a function or method
在使用Myeclipse10部署完项目后,原先不出错的项目,会有红色的叉叉,JSP页面会提示onclick函数错误 Cannot return from outside a function or m ...
- jsp页面无法识别el表达式的解决方案
今天在写一个springmvc的小demo时,碰到一个问题,在jsp页面中书写为${user.username}的表达式语言,在浏览器页面中仍然显示为${user.username},说明jsp根本不 ...
- 浅谈JSP中include指令与include动作标识的区别
JSP中主要包含三大指令,分别是page,include,taglib.本篇主要提及include指令. include指令使用格式:<%@ include file="文件的绝对路径 ...
- 浅谈JSP注释
HTML注释 JSP文件是由HTML尿急和嵌入的Java程序片段组成的,所以在HTML中的注释同样可以在JSP文件中使用.注释格式:<!--注释内容--> <!-- 欢迎提示信息! ...
随机推荐
- 两种方式连接mysql
一种方式:运行命令符后,mysql -u root -p(如果不成功,说明环境变量没配,命令行到 mysql的bin目录下,然后运行mysql -u root -p 应该成功了) 另外一种方式,直接有 ...
- 经典的iptables shell脚本
PS:这个iptables脚本不错,很实用,根据实际应用改一下就可以自己用.分享出来,供大家来参考.原作者佚名.源代码如下: #!/bin/sh modprobe ipt_MASQUERADE mod ...
- Amazon 开始接受 Windows 礼品卡预订
在 8 月微软虚拟货币系统 Microsoft Points 已经正式被真实货币替代,但目前,配套真实货币系统将推出的礼品卡还并没有开始销售.Amazon 上的一则预订显示“Windows 礼品卡”( ...
- MVC框架 - AJAX支持
Ajax是异步JavaScript和XML的一个简写形式.MVC框架包含了不显眼的Ajax内置支持,通过它可以使用辅助方法,在所有的视图添加代码来定义Ajax特性. 在MVC中此特征是基于jQuery ...
- pyenv的安装和使用
1. 先安装crul和git sudo apt-get install curl git-core 2. 安装pyenv curl https://raw.github.com/yyuu/pyenv- ...
- Linux Centos 7 使用yum安装 mysql5.7 (实验成功)
第一部分:安装Mysql5.7 1.下载YUM库 shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.no ...
- 一路踩过的坑 php
1.数据表唯一索引 (两列字段,组合索引) 遇到的情形:项目搭建新测试环境(其实就是所谓的灰度 与线上一致的一个环境):从线上拉回来代码搭建的,数据也是来自于线上数据,但是由于线上数据有部分为机密数 ...
- python 基础——私有属性
私有属性 python 私有属性以两个下划线开头. python 私有属性只能在类内部访问,类外面访问会出错. python 私有属性之所以不能在外面直接通过名称来访问,其实质是因为 python 做 ...
- 实现toolbar透明的背景效果
//MyToolbar.h 头文件 @interface MyToolbar : UIToolbar @end //MyToolbar.m 实现文件 #import "MyToolbar.h ...
- sass中出现的中文问题
在这园子里看到了很多优秀的资源,自己也想写写东西,就突然想到了以前遇到写sass的时候出现中文乱码的解决方案.所有就自己又总结了一下.(以下测试步骤都是自己完成的!没有任何转载,如有错误,希望大家指正 ...