?? happyaxis.jsp
字號:
* @param errorText * @throws Exception */ int wantResource(JspWriter out, String resource, String errorText) throws Exception { if(!resourceExists(resource)) { out.write("<p><b>Warning</b>: could not find resource "+resource +"<br>" +errorText); return 0; } else { out.write("found "+resource+"<br>"); return 1; } } /** * get servlet version string * */ public String getServletVersion() { ServletContext context=getServletConfig().getServletContext(); int major = context.getMajorVersion(); int minor = context.getMinorVersion(); return Integer.toString(major) + '.' + Integer.toString(minor); } /** * what parser are we using. * @return the classname of the parser */ private String getParserName() { SAXParser saxParser = getSAXParser(); if (saxParser == null) { return "Could not create an XML Parser"; } // check to what is in the classname String saxParserName = saxParser.getClass().getName(); return saxParserName; } /** * Create a JAXP SAXParser * @return parser or null for trouble */ private SAXParser getSAXParser() { SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); if (saxParserFactory == null) { return null; } SAXParser saxParser = null; try { saxParser = saxParserFactory.newSAXParser(); } catch (Exception e) { } return saxParser; } /** * get the location of the parser * @return path or null for trouble in tracking it down */ private String getParserLocation(JspWriter out) { SAXParser saxParser = getSAXParser(); if (saxParser == null) { return null; } String location = getLocation(out,saxParser.getClass()); return location; } %><html><head><title>Axis Happiness Page</title></head><body><h1>Axis Happiness Page</h1><h2>Examining webapp configuration</h2><p><h3>Needed Components</h3><% int needed=0,wanted=0; /** * the essentials, without these Axis is not going to work */ needed=needClass(out, "javax.xml.soap.SOAPMessage", "soap.jar", "SAAJ API", "Axis will not work", "http://xml.apache.org/axis/"); needed+=needClass(out, "javax.xml.rpc.Service", "jaxrpc.jar", "JAX-RPC API", "Axis will not work", "http://xml.apache.org/axis/"); needed+=needClass(out, "org.jboss.axis.transport.http.AxisServlet", "axis.jar", "Apache-Axis", "Axis will not work", "http://xml.apache.org/axis/"); needed+=needClass(out, "org.apache.commons.discovery.Resource", "commons-discovery.jar", "Jakarta-Commons Discovery", "Axis will not work", "http://jakarta.apache.org/commons/discovery.html"); needed+=needClass(out, "org.apache.commons.logging.Log", "commons-logging.jar", "Jakarta-Commons Logging", "Axis will not work", "http://jakarta.apache.org/commons/logging.html"); needed+=needClass(out, "org.apache.log4j.Layout", "log4j-1.2.8.jar", "Log4j", "Axis may not work", "http://jakarta.apache.org/log4j"); //should we search for a javax.wsdl file here, to hint that it needs //to go into an approved directory? because we dont seem to need to do that. needed+=needClass(out, "com.ibm.wsdl.factory.WSDLFactoryImpl", "wsdl4j.jar", "IBM's WSDL4Java", "Axis will not work", null); needed+=needClass(out, "javax.xml.parsers.SAXParserFactory", "xerces.jar", "JAXP implementation", "Axis will not work", "http://xml.apache.org/xerces-j/"); needed+=needClass(out,"javax.activation.DataHandler", "activation.jar", "Activation API", "Axis will not work", "http://java.sun.com/products/javabeans/glasgow/jaf.html");%><h3>Optional Components</h3><% /* * now the stuff we can live without */ wanted+=wantClass(out,"javax.mail.internet.MimeMessage", "mail.jar", "Mail API", "Attachments will not work", "http://java.sun.com/products/javamail/"); wanted+=wantClass(out,"org.apache.xml.security.Init", "xmlsec.jar", "XML Security API", "XML Security is not supported", "http://xml.apache.org/security/"); wanted += wantClass(out, "javax.net.ssl.SSLSocketFactory", "jsse.jar or java1.4+ runtime", "Java Secure Socket Extension", "https is not supported", "http://java.sun.com/products/jsse/"); /* * resources on the classpath path */ /* broken; this is a file, not a resource wantResource(out,"/server-config.wsdd", "There is no server configuration file;" +"run AdminClient to create one"); */ /* add more libraries here */ out.write("<h3>"); //is everythng we need here if(needed==0) { //yes, be happy out.write("<i>The core axis libraries are present. </i>"); } else { //no, be very unhappy response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); out.write("<i>" +needed +" core axis librar" +(needed==1?"y is":"ies are") +" missing</i>"); } //now look at wanted stuff if(wanted>0) { out.write("<i>" +wanted +" optional axis librar" +(wanted==1?"y is":"ies are") +" missing</i>"); } else { out.write("The optional components are present."); } out.write("</h3>"); //hint if anything is missing if(needed>0 || wanted>0 ) { out.write(getInstallHints(request)); } %> <p> <B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your web service will work, because there are many configuration options that we do not check for. These tests are <i>necessary</i> but not <i>sufficient</i> <hr> <h2>Examining Application Server</h2> <% String servletVersion=getServletVersion(); String xmlParser=getParserName(); String xmlParserLocation = getParserLocation(out); %> <table> <tr><td>Servlet version</td><td><%= servletVersion %></td></tr> <tr><td>XML Parser</td><td><%= xmlParser %></td></tr> <tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr> </table><% if(xmlParser.indexOf("crimson")>=0) { %> <p> <b>We recommend <a href="http://xml.apache.org/xerces2-j/">Xerces 2</a> over Crimson as the XML parser for Axis</b> </p><% } %> <h2>Examining System Properties</h2><% /** * Dump the system properties */ java.util.Enumeration e=null; try { e= System.getProperties().propertyNames(); } catch (SecurityException se) { } if(e!=null) { out.write("<pre>"); for (;e.hasMoreElements();) { String key = (String) e.nextElement(); out.write(key + "=" + System.getProperty(key)+"\n"); } out.write("</pre><p>"); } else { out.write("System properties are not accessible<p>"); }%> <hr> Platform: <%= getServletConfig().getServletContext().getServerInfo() %></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -