<%@ page contentType="text/html; charset=UTF-8" %> <%@page import="java.util.*"%> <%@page import="java.awt.image.BufferedImage"%> <%@page import="java.awt.*"%> <%@page import="java.io.*"%> <% 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; } } %> JSP探针 JSP探针 Request Variables: Property Value getAuthType <%=request.getAuthType()%> getCharacterEncoding <%=request.getCharacterEncoding()%> getContentLength <%=request.getContentLength()%> getContentType <%=request.getContentType()%> getContextPath <%=request.getContextPath()%> getLocale <%=request.getLocale()%> getLocales <%=request.getLocales()%> getMethod <%=request.getMethod()%> getPathInfo <%=request.getPathInfo()%> getPathTranslated <%=request.getPathTranslated()%> getProtocol <%=request.getProtocol()%> getReader <%=request.getReader()%> getRealPath <%=request.getRealPath(".")%> getRemoteAddr <%=request.getRemoteAddr()%> getRemoteHost <%=request.getRemoteHost()%> getRemoteUser <%=request.getRemoteUser()%> getRequestDispatcher <%=request.getRequestDispatcher("/")%> getRequestURI <%=request.getRequestURI()%> getRequestURL <%=request.getRequestURL()%> getServerName <%=request.getServerName()%> getServerPort <%=request.getServerPort()%> getServletPath <%=request.getServletPath()%> getUserPrincipal <%=request.getUserPrincipal()%> Session Variables: Property Value <% Enumeration e = session.getAttributeNames(); while (e.hasMoreElements()) { String name = (String)e.nextElement(); String value = (String)session.getAttribute(name); %> <%=name%> <%=value%> <% } %> Application Variables: Property Value <% e = application.getAttributeNames(); while (e.hasMoreElements()) { String name = (String)e.nextElement(); %> <%=name%> <%=application.getAttribute(name)%> <% } %> Cookies Variables: Property Value <% Cookie[] cos=request.getCookies(); if(cos!=null){ for(int i=0;i<cos.length;i++) { %> <%=cos[i].getName()%> <%=cos[i].getValue()%> <% } } %> Server Variables: Property Value <% Properties props=System.getProperties(); Iterator iter=props.keySet().iterator(); while(iter.hasNext()) { String key=(String)iter.next(); %> <%=key%> <%=props.get(key)%> <% } %> Lib Info <% LibInfo lib=new LibInfo(); %> Property Value supportJNDI <%=lib.isSupportJNDI()%> supportJavaxSql <%=lib.isSupportJavaxSql()%> supportJAF <%=lib.isSupportJAF()%> supportMail <%=lib.isSupportMail()%> supportBeanUtils <%=lib.isSupportBeanUtils()%> supportCommonLogging <%=lib.isSupportCommonLogging()%> supportCommonCodec <%=lib.isSupportCommonCodec()%> supportCommonCollection <%=lib.isSupportCommonCollection()%> supportCommonDigester <%=lib.isSupportCommonDigester()%> supportCommonLang <%=lib.isSupportCommonLang()%> supportJakartaRegExp <%=lib.isSupportJakartaRegExp()%> supportLucene <%=lib.isSupportLucene()%> supportDom4j <%=lib.isSupportDom4j()%> supportMmMysqlDriver <%=lib.isSupportMmMysqlDriver()%> supportComMysqlDriver <%=lib.isSupportComMysqlDriver()%> supportImageProcessing <%=lib.isSupportImageProcessing()%> <% 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)); %>