You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/12/02 10:14:42 UTC

svn commit: r351640 - /webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp

Author: deepal
Date: Fri Dec  2 01:14:35 2005
New Revision: 351640

URL: http://svn.apache.org/viewcvs?rev=351640&view=rev
Log:
updating jsps

Modified:
    webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp

Modified: webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp?rev=351640&r1=351639&r2=351640&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp (original)
+++ webservices/axis2/trunk/java/modules/core/webapp/HappyAxis.jsp Fri Dec  2 01:14:35 2005
@@ -2,7 +2,8 @@
 <%@ page import="org.apache.axis2.AxisFault,
                  org.apache.axis2.Constants,
                  org.apache.axis2.addressing.EndpointReference,
-                 org.apache.axis2.clientapi.Call,
+                 org.apache.axis2.client.Call,
+                 org.apache.axis2.client.Options,
                  org.apache.axis2.om.OMAbstractFactory,
                  org.apache.axis2.om.OMElement,
                  org.apache.axis2.om.OMFactory,
@@ -10,43 +11,47 @@
                  javax.servlet.ServletContext,
                  javax.servlet.http.HttpServletRequest,
                  javax.servlet.http.HttpServletResponse,
-                 javax.xml.namespace.QName,
-                 javax.xml.parsers.SAXParser,
-                 javax.xml.parsers.SAXParserFactory,
-                 javax.xml.stream.XMLOutputFactory"
-   session="false" %>
-<%@ page import="javax.xml.stream.XMLStreamException"%>
-<%@ page import="java.io.IOException"%>
-<%@ page import="java.io.InputStream"%>
+                 javax.servlet.jsp.JspWriter,
+                 javax.xml.namespace.QName"
+         session="false" %>
+<%@ page import="javax.xml.parsers.SAXParser" %>
+<%@ page import="javax.xml.parsers.SAXParserFactory" %>
+<%@ 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"%>
 <%
-     /*
-     * Copyright 2002,2004 The Apache Software Foundation.
-     *
-     * Licensed 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.
-     */
- %>
+    /*
+    * Copyright 2002,2004 The Apache Software Foundation.
+    *
+    * Licensed 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>
-<title>Axis2 Happiness Page</title>
-<link href="css/axis-style.css" rel="stylesheet" type="text/css">
+    <title>Axis2 Happiness Page</title>
+    <link href="css/axis-style.css" rel="stylesheet" type="text/css">
 </head>
+
 <body>
-   <jsp:include page="include/header.inc"></jsp:include>
-	<jsp:include page="include/link-footer.jsp"></jsp:include>
-<%port =request.getServerPort();%>
-<%IP=request.getRequestURL().toString();
+<jsp:include page="include/header.inc"/>
+<jsp:include page="include/link-footer.jsp"/>
+<%port = request.getServerPort();%>
+<%IP = request.getRequestURL().toString();
     int lastindex = IP.lastIndexOf('/');
-    IP = IP.substring(0,lastindex);
+    IP = IP.substring(0, lastindex);
     targetEPR = new EndpointReference(IP + "/services/version");
 %>
 <%!
@@ -58,17 +63,18 @@
     */
     int port = 0;
     String IP;
-    EndpointReference targetEPR ;
+    EndpointReference targetEPR;
+
     /**
      * Get a string providing install information.
      * TODO: make this platform aware and give specific hints
      */
     public String getInstallHints(HttpServletRequest request) {
 
-        String hint=
+        String hint =
                 "<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.";
+                        + "java.* or javax.* packages into CATALINA_HOME/common/lib"
+                        + "<br>jaxrpc.jar and saaj.jar are two such libraries.";
         return hint;
     }
 
@@ -92,9 +98,9 @@
      */
     boolean resourceExists(String resource) {
         boolean found;
-        InputStream instream=this.getClass().getResourceAsStream(resource);
-        found=instream!=null;
-        if(instream!=null) {
+        InputStream instream = this.getClass().getResourceAsStream(resource);
+        found = instream != null;
+        if (instream != null) {
             try {
                 instream.close();
             } catch (IOException e) {
@@ -123,42 +129,41 @@
                    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>";
+            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>");
+                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 + ") at " + location + "<br>");
+                if (location == null) {
+                    out.write("Found " + axisOperation + " (" + classname + ")<br>");
+                } else {
+                    out.write("Found " + axisOperation + " (" + classname + ") at " + location + "<br>");
                 }
                 return 0;
             }
-        } catch(NoClassDefFoundError ncdfe) {
-            String url="";
-            if(homePage!=null) {
-                url="<br>  See <a href="+homePage+">"+homePage+"</a>";
+        } 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>");
+            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;
         }
     }
@@ -175,18 +180,18 @@
         try {
             java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
             String location = url.toString();
-            if(location.startsWith("jar")) {
-                url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL();
+            if (location.startsWith("jar")) {
+                url = ((java.net.JarURLConnection) url.openConnection()).getJarFileURL();
                 location = url.toString();
             }
 
-            if(location.startsWith("file")) {
+            if (location.startsWith("file")) {
                 java.io.File file = new java.io.File(url.getFile());
                 return file.getAbsolutePath();
             } else {
                 return url.toString();
             }
-        } catch (Throwable t){
+        } catch (Throwable t) {
         }
         return "an unknown location";
     }
@@ -251,13 +256,13 @@
     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);
+        if (!resourceExists(resource)) {
+            out.write("<p><b>Warning</b>: could not find resource " + resource
+                    + "<br>"
+                    + errorText);
             return 0;
         } else {
-            out.write("found "+resource+"<br>");
+            out.write("found " + resource + "<br>");
             return 1;
         }
     }
@@ -269,14 +274,13 @@
      */
 
     public String getServletVersion() {
-        ServletContext context=getServletConfig().getServletContext();
+        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
@@ -319,12 +323,13 @@
         if (saxParser == null) {
             return null;
         }
-        String location = getLocation(out,saxParser.getClass());
+        String location = getLocation(out, saxParser.getClass());
         return location;
     }
 
     private String value;
     private QName operationName = new QName("getVersion");
+
     private OMElement createEnvelope() {
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
@@ -333,12 +338,17 @@
         method.addChild(value);
         return method;
     }
+
     public boolean inVokeTheService() {
         try {
             OMElement payload = createEnvelope();
             Call call = new Call();
-            call.setTo(targetEPR);
-            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+            Options options = new Options();
+            call.setClientOptions(options);
+            options.setTo(targetEPR);
+            options.setTransportInfo(Constants.TRANSPORT_HTTP,
+                    Constants.TRANSPORT_HTTP,
+                    false);
 
             OMElement result =
                     call.invokeBlocking(operationName.getLocalPart(), payload);
@@ -358,39 +368,42 @@
 %>
 
 <h1>Axis2 Happiness Page</h1>
+
 <h2>Examining webapp configuration</h2>
+
 <p>
+
 <h3>Essential Components</h3>
 <%
-    int needed=0,wanted=0;
+    int needed = 0,wanted = 0;
 
     /**
      * the essentials, without these Axis is not going to work
      */
-    needed=needClass(out, "org.apache.axis2.transport.http.AxisServlet",
-            "axis2-0.9.jar",
+    needed = needClass(out, "org.apache.axis2.transport.http.AxisServlet",
+            "axis2-0.93.jar",
             "Apache-Axis",
             "Axis2 will not work",
             "http://xml.apache.org/axis/");
-    needed+=needClass(out, "org.apache.commons.logging.Log",
+    needed += needClass(out, "org.apache.commons.logging.Log",
             "commons-logging.jar",
             "Jakarta-Commons Logging",
             "Axis2 will not work",
             "http://jakarta.apache.org/commons/logging.html");
 
-    needed+=needClass(out, "org.apache.log4j.Layout",
+    needed += needClass(out, "org.apache.log4j.Layout",
             "log4j-1.2.8.jar",
             "Log4j",
             "Axis2 may not work",
             "http://jakarta.apache.org/log4j");
-    needed+=needClass(out, "javax.xml.stream.XMLStreamReader",
+    needed += needClass(out, "javax.xml.stream.XMLStreamReader",
             "stax-api-1.0.jar",
             "Streaming API for XML",
             "Axis2 will not work",
             "http://dist.codehaus.org/stax/jars/");
-    needed+=needClass(out, "com.bea.xml.stream.MXParser",
-            "stax-1.1.2-dev.jar",
-            "Streaming API for XML implementation",
+    needed += needClass(out, "org.codehaus.stax2.XMLStreamWriter2",
+            "wstx-asl-2.8.jar",
+            "Streaming Impl for XML implementation",
             "Axis2 will not work",
             "http://dist.codehaus.org/stax/jars/");
 
@@ -409,77 +422,80 @@
 
     out.write("<h3>");
     //is everythng we need here
-    if(needed==0) {
+    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>");
+                + needed
+                + " core axis librar"
+                + (needed == 1 ? "y is" : "ies are")
+                + " missing</i>");
     }
     //now look at wanted stuff
 
     out.write("</h3>");
 %>
 <p>
-<B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee your
-web axisService 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>
+    <B><I>Note:</I></B> Even if everything this page probes for is present, there is no guarantee
+    your
+    web axisService 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>
 
 <h2>Examining echo axisService</h2>
-    <%
-        boolean serviceStatus = inVokeTheService();
-        if(serviceStatus){
-    %>
-    <p>
-    <font color="blue" >
-    Found the Axis2 default Version axisService and Axis2 is working properly.Now you can drop a web axisService in
-    axis2/WEB-INF/services and refresh this page.
-
-    Following output was produced while invoking the version axisService:
-    <br>
-       <%= value%> </font>
-       </p>
-       
-   <%
-        }   else {
-   %>
-   <p>
-   <font color="brown" >
-   You can test the deployement functionality by uploading the echo axisService jar, which can be found in the
-   samples directory of the axis distribution.
-   <br>
-     </font>
-     </p>
-     
-    <%
-        }
-    %>
-    <h2>Examining Application Server</h2>
-    <table>
+<%
+    boolean serviceStatus = inVokeTheService();
+    if (serviceStatus) {
+%>
+<p>
+    <font color="blue">
+        Found the Axis2 default Version axisService and Axis2 is working properly.Now you can drop a
+        web axisService in
+        axis2/WEB-INF/services and refresh this page.
+
+        Following output was produced while invoking the version axisService:
+        <br>
+        <%= value%></font>
+</p>
+
+<%
+} else {
+%>
+<p>
+    <font color="brown">
+        You can test the deployement functionality by uploading the echo axisService jar, which can
+        be found in the
+        samples directory of the axis distribution.
+        <br>
+    </font>
+</p>
+
+<%
+    }
+%>
+<h2>Examining Application Server</h2>
+<table>
     <tr><td>Servlet version</td><td><%=getServletVersion()%></td></tr>
     <tr><td>Platform</td><td><%=getServletConfig().getServletContext().getServerInfo()%></td></tr>
-    </table>
+</table>
 
-    <h2>Examining System Properties</h2>
+<h2>Examining System Properties</h2>
 <%
     /**
      * Dump the system properties
      */
-    java.util.Enumeration e=null;
+    java.util.Enumeration e = null;
     try {
-        e= System.getProperties().propertyNames();
+        e = System.getProperties().propertyNames();
     } catch (SecurityException se) {
     }
-    if(e!=null) {
+    if (e != null) {
         out.write("<pre>");
-        for (;e.hasMoreElements();) {
+        for (; e.hasMoreElements();) {
             String key = (String) e.nextElement();
-            out.write(key + "=" + System.getProperty(key)+"\n");
+            out.write(key + "=" + System.getProperty(key) + "\n");
         }
         out.write("</pre><p>");
     } else {
@@ -487,7 +503,7 @@
     }
 %>
 
-	<jsp:include page="include/footer.inc"></jsp:include>
+<jsp:include page="include/footer.inc"/>
 </body>
 </html>