⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 happyaxis.jsp

📁 开源的axis2框架的源码。用于开发WEBSERVER
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<html><%@ page import="org.apache.axiom.om.OMAbstractFactory,                 org.apache.axiom.om.OMElement,                 org.apache.axiom.om.OMFactory,                 org.apache.axiom.om.OMNamespace,                 org.apache.axis2.AxisFault,                 org.apache.axis2.Constants,                 org.apache.axis2.addressing.EndpointReference,                 org.apache.axis2.client.Options,                 org.apache.axis2.client.ServiceClient,                 org.apache.axis2.context.ConfigurationContext,                 org.apache.axis2.context.ConfigurationContextFactory,                 javax.servlet.ServletContext,                 javax.servlet.http.HttpServletRequest,                 javax.servlet.http.HttpServletResponse,                 javax.servlet.jsp.JspWriter,                 javax.xml.parsers.SAXParser,                 javax.xml.parsers.SAXParserFactory"         session="false" %><%@ page import="javax.xml.stream.XMLOutputFactory" %><%@ page import="javax.xml.stream.XMLStreamException" %><%@ page import="java.io.IOException" %><%@ page import="java.io.InputStream" %><%@ page import="java.io.StringWriter" %><%@ page import="java.lang.Class" %><%@ page import="java.lang.ClassNotFoundException"%><%@ page import="java.lang.Exception" %><%@ page import="java.lang.Integer" %><%@ page import="java.lang.NoClassDefFoundError" %><%@ page import="java.lang.SecurityException" %><%@ page import="java.lang.String" %><%@ page import="java.lang.System" %><%@ page import="java.lang.Throwable" %><%--  ~ Licensed to the Apache Software Foundation (ASF) under one  ~ or more contributor license agreements. See the NOTICE file  ~ distributed with this work for additional information  ~ regarding copyright ownership. The ASF licenses this file  ~ to you under the Apache License, Version 2.0 (the  ~ "License"); you may not use this file except in compliance  ~ with the License. You may obtain a copy of the License at  ~  ~ http://www.apache.org/licenses/LICENSE-2.0  ~  ~ Unless required by applicable law or agreed to in writing,  ~ software distributed under the License is distributed on an  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY  ~ KIND, either express or implied. See the License for the  ~ specific language governing permissions and limitations  ~ under the License.  --%><head>    <jsp:include page="include/httpbase.jsp"/>    <title>Axis2 Happiness Page</title>    <link href="axis2-web/css/axis-style.css" rel="stylesheet" type="text/css"></head><body><jsp:include page="include/header.inc"/><jsp:include page="include/link-footer.jsp"/><%IP = request.getRequestURL().toString();%><%!    /*    * Happiness tests for axis2. These look at the classpath and warn if things    * are missing. Normally addng this much code in a JSP page is mad    * but here we want to validate JSP compilation too, and have a drop-in    * page for easy re-use    */    String IP;    /**     * Get a string providing install information.     * TODO: make this platform aware and give specific hints     */    public String getInstallHints(HttpServletRequest request) {        return "<B><I>Note:</I></B> On Tomcat 4.x and Java1.4, you may need to put libraries that contain "                + "java.* or javax.* packages into CATALINA_HOME/common/lib"                + "<br>jaxrpc.jar and saaj.jar are two such libraries.";    }    /**     * test for a class existing     * @param classname     * @return class iff present     */    Class classExists(String classname) {        try {            return Class.forName(classname);        } catch (ClassNotFoundException e) {            return null;        }    }    /**     * test for resource on the classpath     * @param resource     * @return true iff present     */    boolean resourceExists(String resource) {        boolean found;        InputStream instream = this.getClass().getResourceAsStream(resource);        found = instream != null;        if (instream != null) {            try {                instream.close();            } catch (IOException e) {            }        }        return found;    }    /**     * probe for a class, print an error message is missing     * @param out stream to print stuff     * @param category text like "warning" or "error"     * @param classname class to look for     * @param jarFile where this class comes from     * @param errorText extra error text     * @param homePage where to d/l the library     * @return the number of missing classes     * @throws IOException     */    int probeClass(JspWriter out,                   String category,                   String classname,                   String jarFile,                   String axisOperation,                   String errorText,                   String homePage) throws IOException {        try {            Class clazz = classExists(classname);            if (clazz == null) {                String url = "";                if (homePage != null) {                    url = "<br>  See <a href=" + homePage + ">" + homePage + "</a>";                }                out.write("<p>" + category + ": could not find class " + classname                        + " from file <b>" + jarFile                        + "</b><br>  " + errorText                        + url                        + "<p>");                return 1;            } else {                String location = getLocation(out, clazz);                if (location == null) {                    out.write("Found " + axisOperation + " (" + classname + ")<br/>");                } else {                    out.write("Found " + axisOperation + " (" + classname + ") <br/> &nbsp;&nbsp;at " + location + "<br/>");                }                return 0;            }        } catch (NoClassDefFoundError ncdfe) {            String url = "";            if (homePage != null) {                url = "<br>  See <a href=" + homePage + ">" + homePage + "</a>";            }            out.write("<p>" + category + ": could not find a dependency"                    + " of class " + classname                    + " from file <b>" + jarFile                    + "</b><br> " + errorText                    + url                    + "<br>The root cause was: " + ncdfe.getMessage()                    + "<br>This can happen e.g. if " + classname + " is in"                    + " the 'common' classpath, but a dependency like "                    + " activation.jar is only in the webapp classpath."                    + "<p>");            return 1;        }    }    /**     * get the location of a class     * @param out     * @param clazz     * @return the jar file or path where a class was found     */    String getLocation(JspWriter out,                       Class clazz) {        try {            java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();            String location = url.toString();            if (location.startsWith("jar")) {                url = ((java.net.JarURLConnection) url.openConnection()).getJarFileURL();                location = url.toString();            }            if (location.startsWith("file")) {                java.io.File file = new java.io.File(url.getFile());                return file.getAbsolutePath();            } else {                return url.toString();            }        } catch (Throwable t) {        }        return "an unknown location";    }    /**     * a class we need if a class is missing     * @param out stream to print stuff     * @param classname class to look for     * @param jarFile where this class comes from     * @param errorText extra error text     * @param homePage where to d/l the library     * @throws IOException when needed     * @return the number of missing libraries (0 or 1)     */    int needClass(JspWriter out,                  String classname,                  String jarFile,                  String axisOperation,                  String errorText,                  String homePage) throws IOException {        return probeClass(out,                "<b>Error</b>",                classname,                jarFile,                axisOperation,                errorText,                homePage);    }    /**     * print warning message if a class is missing     * @param out stream to print stuff     * @param classname class to look for     * @param jarFile where this class comes from     * @param errorText extra error text     * @param homePage where to d/l the library     * @throws IOException when needed     * @return the number of missing libraries (0 or 1)     */    int wantClass(JspWriter out,                  String classname,                  String jarFile,                  String axisOperation,                  String errorText,                  String homePage) throws IOException {        return probeClass(out,                "<b>Warning</b>",                classname,                jarFile,                axisOperation,                errorText,                homePage);    }    /**     * probe for a resource existing,     * @param out     * @param resource     * @param errorText     * @throws Exception     */    int wantResource(JspWriter out,                     String resource,                     String errorText) throws Exception {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -