cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r664075 - in /cxf/branches/2.0.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
Date Fri, 06 Jun 2008 18:53:22 GMT
Author: dkulp
Date: Fri Jun  6 11:53:21 2008
New Revision: 664075

URL: http://svn.apache.org/viewvc?rev=664075&view=rev
Log:
Merged revisions 664073 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r664073 | dkulp | 2008-06-06 14:35:42 -0400 (Fri, 06 Jun 2008) | 3 lines
  
  [CXF-1630] Make the service list a bit nicer.  Patch from Jan Minaroviech applied.   Thanks!
........

Added:
    cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist.css
      - copied unchanged from r664073, cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist.css
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
    cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java?rev=664075&r1=664074&r2=664075&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/AbstractCXFServlet.java
Fri Jun  6 11:53:21 2008
@@ -65,6 +65,10 @@
         if (forcedBaseAddress != null) {
             newController.setForcedBaseAddress(forcedBaseAddress);
         }
+        String serviceListStyleSheet = servletConfig.getInitParameter("service-list-stylesheet");
+        if (serviceListStyleSheet != null) {
+            newController.setServiceListStyleSheet(serviceListStyleSheet);
+        }
         return newController;
     }
     

Modified: cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=664075&r1=664074&r2=664075&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Fri Jun  6 11:53:21 2008
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Set;
 import java.util.logging.Level;
@@ -32,7 +33,9 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.xmlsoap.schemas.wsdl.http.AddressType;
@@ -47,6 +50,7 @@
     private boolean isHideServiceList;
     private boolean disableAddressUpdates;
     private String forcedBaseAddress;
+    private String serviceListStyleSheet;
  
     public ServletController(ServletTransportFactory df, AbstractCXFServlet servlet) {
         this.transport = df;
@@ -62,6 +66,9 @@
     public void setForcedBaseAddress(String s) {
         forcedBaseAddress = s;
     }
+    public void setServiceListStyleSheet(String serviceListStyleSheet) {
+        this.serviceListStyleSheet = serviceListStyleSheet;
+    }
     
     private synchronized void updateDests(HttpServletRequest request) {
         if (disableAddressUpdates) {
@@ -169,20 +176,66 @@
     
     private void generateServiceList(HttpServletRequest request, HttpServletResponse response)
         throws IOException {
+        
+        if (request.getParameter("stylesheet") != null) {
+            URL url = this.getClass().getResource("servicelist.css");
+            if (url != null) {
+                IOUtils.copy(url.openStream(), response.getOutputStream());
+            }
+            return;
+        }
+        
         Collection<ServletDestination> destinations = transport.getDestinations();
         response.setContentType("text/html");        
-        response.getWriter().write("<html><body>");
+        response.setCharacterEncoding("UTF-8");
+        
+        response.getWriter().write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
" 
+                + "\"http://www.w3.org/TR/html4/loose.dtd\">");
+        response.getWriter().write("<HTML><HEAD>");
+        if (serviceListStyleSheet != null) {
+            response.getWriter().write(
+                    "<LINK type=\"text/css\" rel=\"stylesheet\" href=\"" 
+                    + request.getContextPath() + "/" + serviceListStyleSheet + "\">");
+        } else {
+            response.getWriter().write(
+                                       "<LINK type=\"text/css\" rel=\"stylesheet\" href=\""

+                                       + request.getRequestURI() + "/?stylesheet=1\">");
           
+        }
+        response.getWriter().write("<meta http-equiv=content-type content=\"text/html;
charset=UTF-8\">");
+        response.getWriter().write("<title>CXF - Service list</title>");
+        response.getWriter().write("</head><body>");
         if (!isHideServiceList) {
             if (destinations.size() > 0) {  
+                response.getWriter().write("<span class=\"heading\">Available services:</span><br/>");
+                response.getWriter().write("<table " + (serviceListStyleSheet == null
+                        ? "cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"100%\""
: "") + ">");
                 for (ServletDestination sd : destinations) {
                     if (null != sd.getEndpointInfo().getName()) {
+                        response.getWriter().write("<tr><td>");
+                        response.getWriter().write("<span class=\"porttypename\">"
+                                + sd.getEndpointInfo().getInterface().getName().getLocalPart()
+                                + "</span>");
+                        response.getWriter().write("<ul>");
+                        for (OperationInfo oi : sd.getEndpointInfo().getInterface().getOperations())
{
+                            response.getWriter().write("<li>" + oi.getName().getLocalPart()
+ "</li>");
+                        }
+                        response.getWriter().write("</ul>");
+                        response.getWriter().write("</td><td>");
                         String address = sd.getEndpointInfo().getAddress();
-                        response.getWriter().write("<p> <a href=\"" + address +
"?wsdl\">");
-                        response.getWriter().write(sd.getEndpointInfo().getName() + "</a>
</p>");
+                        response.getWriter().write("<span class=\"field\">Endpoint
address:</span> "
+                                + "<span class=\"value\">" + address + "</span>");
+                        response.getWriter().write("<br/><span class=\"field\">Wsdl:</span>
"
+                                + "<a href=\"" + address + "?wsdl\">"
+                                + sd.getEndpointInfo().getService().getName() + "</a>");
+                        response.getWriter().write("<br/><span class=\"field\">Target
namespace:</span> "
+                                + "<span class=\"value\">" 
+                                + sd.getEndpointInfo().getService().getTargetNamespace()
+ "</span>");
+                        response.getWriter().write("</td></tr>");
                     }    
                 }
+                response.getWriter().write("</table>");
             } else {
-                response.getWriter().write("No service was found.");
+                response.getWriter().write("<span class=\"heading\">No service was
found.</span>");
             }
         }    
         response.getWriter().write("</body></html>");



Mime
View raw message