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 2006/03/17 05:53:08 UTC

svn commit: r386535 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http: HTTPTransportReceiver.java HTTPWorker.java ListingAgent.java

Author: deepal
Date: Thu Mar 16 20:53:06 2006
New Revision: 386535

URL: http://svn.apache.org/viewcvs?rev=386535&view=rev
Log:
-when type axis2/services/foo it will show up the service inof (in SimpleHTTPServer)
-btw build is working with me can someone pls check that

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=386535&r1=386534&r2=386535&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Thu Mar 16 20:53:06 2006
@@ -18,6 +18,7 @@
 package org.apache.axis2.transport.http;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
@@ -382,6 +383,36 @@
         temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
                 + "</body></html>";
 
+        return temp;
+    }
+
+    public static String printServiceHTML(String serviceName,
+                                          ConfigurationContext configurationContext) {
+        String temp = "";
+        try {
+            AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
+            AxisService axisService = axisConfig.getService(serviceName);
+            Iterator iterator = axisService.getOperations();
+            temp += "<h3>" + axisService.getName() + "</h3>";
+            temp += "<a href=\"" + axisService.getName() + "?wsdl\">wsdl</a> <br/> ";
+            temp += "<i>Service Description :  " + axisService.getServiceDescription() + "</i><br/><br/>";
+            if (iterator.hasNext()) {
+                temp += "Available operations <ul>";
+                for (; iterator.hasNext();) {
+                    AxisOperation axisOperation = (AxisOperation) iterator.next();
+                    temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
+                }
+                temp += "</ul>";
+            } else {
+                temp += "No operations specified for this service";
+            }
+            temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+                    + "</body></html>";
+        }
+        catch (AxisFault axisFault) {
+            temp = "<html><head><title>Service has a fualt</title></head>" + "<body>"
+                    + "<hr><h2><font color=\"blue\">" + axisFault.getMessage() + "</font></h2></body></html>";
+        }
         return temp;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=386535&r1=386534&r2=386535&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java Thu Mar 16 20:53:06 2006
@@ -139,6 +139,20 @@
                     return true;
                 }
 
+                if (uri.indexOf("?") < 0) {
+                    if (!(uri.endsWith("/axis2/services/") || uri.endsWith("/axis2/services"))) {
+                        String serviceName = uri.replaceAll("/axis2/services/", "");
+                        if (serviceName.indexOf("/") < 0) {
+                            response.addHeader(new Header("Content-Type", "text/html"));
+                            String res = HTTPTransportReceiver.printServiceHTML(serviceName, configurationContext);
+                            byte[] buf = res.getBytes();
+                            response.setBody(new ByteArrayInputStream(buf));
+                            conn.writeResponse(response);
+                            return true;
+                        }
+                    }
+                }
+
                 if (uri.endsWith("?wsdl")) {
                     String serviceName = uri.substring(uri.lastIndexOf("/") + 1, uri.length() - 5);
                     HashMap services = configurationContext.getAxisConfiguration().getServices();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=386535&r1=386534&r2=386535&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Thu Mar 16 20:53:06 2006
@@ -380,7 +380,6 @@
             return;
         } else if ((filePart != null) && filePart.endsWith(Constants.LOGOUT)) {
             logout(httpServletRequest, httpServletResponse);
-
             return;
         }
 
@@ -490,9 +489,7 @@
                 }
             }
         }
-
         String URI = req.getRequestURI();
-
         URI = URI.substring(0, URI.indexOf("services"));
         res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
     }