Author: asankha
Date: Wed Oct 10 02:23:23 2007
New Revision: 583403

URL: http://svn.apache.org/viewvc?rev=583403&view=rev
Log:
fix http://issues.apache.org/jira/browse/SYNAPSE-140 and 
http://issues.apache.org/jira/browse/SYNAPSE-139

Modified:
    
webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties
    
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
    
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties?rev=583403&r1=583402&r2=583403&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties 
(original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/resources/log4j.properties 
Wed Oct 10 02:23:23 2007
@@ -32,6 +32,7 @@
 
 # Synapse log level is info, so are transports
 log4j.category.org.apache.synapse=INFO
+log4j.category.org.apache.synapse.transport=INFO\
 log4j.category.org.apache.axis2.transport=INFO
 
 # The console appender is used to display general information at console

Modified: 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java?rev=583403&r1=583402&r2=583403&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
 Wed Oct 10 02:23:23 2007
@@ -92,12 +92,6 @@
 
         // register to receive updates on services for lifetime management
         cfgCtx.getAxisConfiguration().addObservers(axisObserver);
-
-        Map services = cfgCtx.getAxisConfiguration().getServices();
-        Iterator servicesIter = services.values().iterator();
-        while (servicesIter.hasNext()) {
-            startListeningForService((AxisService) servicesIter.next());
-        }
     }
 
     public void destroy() {

Modified: 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java?rev=583403&r1=583402&r2=583403&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/nhttp/ServerWorker.java
 Wed Oct 10 02:23:23 2007
@@ -23,6 +23,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
@@ -365,7 +366,7 @@
             try {
                 response.addHeader(CONTENT_TYPE, TEXT_HTML);
                 serverHandler.commitResponse(conn, response);
-                
os.write(HTTPTransportReceiver.getServicesHTML(cfgCtx).getBytes());
+                os.write(getServicesHTML().getBytes());
 
             } catch (IOException e) {
                 handleException("Error writing ? output to client", e);
@@ -511,5 +512,71 @@
 
     private static boolean isIP(String hostAddress) {
         return hostAddress.split("[.]").length == 4;
+    }
+
+    /**
+     * Returns the HTML text for the list of services deployed.
+     * This can be delegated to another Class as well
+     * where it will handle more options of GET messages.
+     *
+     * @return the HTML to be displayed as a String
+     */
+    public String getServicesHTML() {
+
+        Map services = cfgCtx.getAxisConfiguration().getServices();
+        Hashtable erroneousServices = 
cfgCtx.getAxisConfiguration().getFaultyServices();
+        boolean servicesFound = false;
+
+        StringBuffer resultBuf = new StringBuffer();
+        resultBuf.append("<html><head><title>Axis2: Services</title></head>" + 
"<body>");
+
+        if ((services != null) && !services.isEmpty()) {
+
+            servicesFound = true;
+            Collection serviceCollection = services.values();
+            resultBuf.append("<h2>" + "Deployed services" + "</h2>");
+
+            for (Iterator it = serviceCollection.iterator(); it.hasNext();) {
+
+                AxisService axisService = (AxisService) it.next();
+                if (axisService.getName().startsWith("__")) {
+                    continue;    // skip private services
+                }
+
+                Iterator iterator = axisService.getOperations();
+                resultBuf.append("<h3><a href=\"" + axisService.getName() + 
"?wsdl\">" +
+                        axisService.getName() + "</a></h3>");
+
+                if (iterator.hasNext()) {
+                    resultBuf.append("Available operations <ul>");
+
+                    for (; iterator.hasNext();) {
+                        AxisOperation axisOperation = (AxisOperation) 
iterator.next();
+                        resultBuf.append("<li>" + 
axisOperation.getName().getLocalPart() + "</li>");
+                    }
+                    resultBuf.append("</ul>");
+                } else {
+                    resultBuf.append("No operations specified for this 
service");
+                }
+            }
+        }
+
+        if ((erroneousServices != null) && !erroneousServices.isEmpty()) {
+            servicesFound = true;
+            resultBuf.append("<hr><h2><font color=\"blue\">Faulty 
Services</font></h2>");
+            Enumeration faultyservices = erroneousServices.keys();
+
+            while (faultyservices.hasMoreElements()) {
+                String faultyserviceName = (String) 
faultyservices.nextElement();
+                resultBuf.append("<h3><font color=\"blue\">" + 
faultyserviceName + "</font></h3>");
+            }
+        }
+
+        if (!servicesFound) {
+            resultBuf.append("<h2>There are no services deployed</h2>");
+        }
+
+        resultBuf.append("</body></html>");
+        return resultBuf.toString();
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to