cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r589714 - in /incubator/cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/annotation/ common/common/src/main/java/org/apache/cxf/resource/ rt/ rt/core/src/main/java/org/apache/cxf/bus/spring/ rt/transports/http/...
Date Mon, 29 Oct 2007 16:18:50 GMT
Author: dkulp
Date: Mon Oct 29 09:18:47 2007
New Revision: 589714

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

........
  r589531 | ningjiang | 2007-10-29 03:23:26 -0400 (Mon, 29 Oct 2007) | 1 line
  
  CXF-1143 added a generate-service-list flage, also fixed some NPEs of the resource resolver
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClassLoaderResolver.java
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClasspathResolver.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
    incubator/cxf/branches/2.0.x-fixes/rt/pom.xml
    incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml

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

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
Mon Oct 29 09:18:47 2007
@@ -127,7 +127,7 @@
             for (Class<? extends Annotation> clz : annotationTypes) {
                 Annotation ann = element.getAnnotation(clz); 
                 if (ann != null) {
-                    try {
+                    try {                        
                         visitorMethod.invoke(visitor, element, ann);
                     } catch (IllegalAccessException e) {
                         // ignore, we're invoking methods of a public interface

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClassLoaderResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClassLoaderResolver.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClassLoaderResolver.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClassLoaderResolver.java
Mon Oct 29 09:18:47 2007
@@ -35,7 +35,7 @@
     }
  
     public <T> T resolve(String resourceName, Class<T> resourceType) {
-        if (resourceType == null) {
+        if (resourceName == null) {
             return null;
         }
         URL url = loader.getResource(resourceName);

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClasspathResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClasspathResolver.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClasspathResolver.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/resource/ClasspathResolver.java
Mon Oct 29 09:18:47 2007
@@ -29,6 +29,9 @@
 public class ClasspathResolver implements ResourceResolver {
 
     public <T> T resolve(String resourceName, Class<T> resourceType) { 
+        if (resourceName == null) {
+            return null;
+        }
         URL url = ClassLoader.getSystemResource(resourceName);
         if (resourceType.isInstance(url)) {
             return resourceType.cast(url);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
Mon Oct 29 09:18:47 2007
@@ -52,6 +52,9 @@
     }
 
     public <T> T resolve(String resourceName, Class<T> resourceType) {
+        if (resourceName == null) {
+            return null;
+        }    
         try { 
             return resourceType.cast(context.getBean(resourceName, resourceType));
         } catch (NoSuchBeanDefinitionException def) {

Modified: incubator/cxf/branches/2.0.x-fixes/rt/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/pom.xml?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/pom.xml Mon Oct 29 09:18:47 2007
@@ -49,6 +49,7 @@
         <module>ws/rm</module>
         <module>ws/security</module>
         <module>management</module>
+        <module>javascript</module>
     </modules>
 
     <scm>

Modified: incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
Mon Oct 29 09:18:47 2007
@@ -65,8 +65,13 @@
     private ServletController controller;
     private GenericApplicationContext childCtx;
 
-    public ServletController createServletController() {
-        return new ServletController(servletTransportFactory, this);
+    public ServletController createServletController(ServletConfig servletConfig) {
+        String generateServiceList = servletConfig.getInitParameter("generate-service-list");
+        ServletController newController = new ServletController(servletTransportFactory,
this);
+        if (generateServiceList != null) {
+            newController.setGenerateServiceList(Boolean.valueOf(generateServiceList));
+        }    
+        return newController;
     }
 
     public ServletController getController() {
@@ -120,7 +125,7 @@
                                                servletConfig.getServletContext()));
         
         // Set up the ServletController
-        controller = createServletController();
+        controller = createServletController(servletConfig);
 
         replaceDestinationFactory();
         
@@ -165,7 +170,7 @@
         replaceDestinationFactory();
 
         // Set up the ServletController
-        controller = createServletController();
+        controller = createServletController(servletConfig);
         
         // build endpoints from the web.xml or a config file
         loadAdditionalConfig(ctx, servletConfig);

Modified: incubator/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/incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Mon Oct 29 09:18:47 2007
@@ -54,10 +54,15 @@
     private ServletTransportFactory transport;
     private CXFServlet cxfServlet;
     private String lastBase = "";
+    private boolean isGenerateServiceList = true;
  
     public ServletController(ServletTransportFactory df, CXFServlet servlet) {
         this.transport = df;
-        this.cxfServlet = servlet;
+        this.cxfServlet = servlet;       
+    }
+    
+    public void setGenerateServiceList(boolean generate) {
+        isGenerateServiceList = generate;
     }
     
     private synchronized void updateDests(HttpServletRequest request) {
@@ -165,18 +170,19 @@
         Collection<ServletDestination> destinations = transport.getDestinations();
         response.setContentType("text/html");        
         response.getWriter().write("<html><body>");
-        
-        if (destinations.size() > 0) {  
-            for (ServletDestination sd : destinations) {
-                if (null != sd.getEndpointInfo().getName()) {
-                    String address = sd.getEndpointInfo().getAddress();
-                    response.getWriter().write("<p> <a href=\"" + address + "?wsdl\">");
-                    response.getWriter().write(sd.getEndpointInfo().getName() + "</a>
</p>");
-                }    
+        if (isGenerateServiceList) {
+            if (destinations.size() > 0) {  
+                for (ServletDestination sd : destinations) {
+                    if (null != sd.getEndpointInfo().getName()) {
+                        String address = sd.getEndpointInfo().getAddress();
+                        response.getWriter().write("<p> <a href=\"" + address +
"?wsdl\">");
+                        response.getWriter().write(sd.getEndpointInfo().getName() + "</a>
</p>");
+                    }    
+                }
+            } else {
+                response.getWriter().write("No service was found.");
             }
-        } else {
-            response.getWriter().write("No service was found.");
-        }
+        }    
         response.getWriter().write("</body></html>");
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
Mon Oct 29 09:18:47 2007
@@ -118,5 +118,18 @@
         
     }
     
+    @Test
+    public void testGetServiceList() throws Exception {
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(true);
+        
+        WebRequest req = 
+            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/");
+        WebResponse res = client.getResponse(req);
+        assertEquals(200, res.getResponseCode());
+        assertEquals("text/html", res.getContentType());
+        assertEquals("Here should have no services links ", 0, res.getLinks().length);
+                
+    }
     
 }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml?rev=589714&r1=589713&r2=589714&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
Mon Oct 29 09:18:47 2007
@@ -39,10 +39,14 @@
 	
 	<servlet>
 		<servlet-name>CXFServlet</servlet-name>
-		<display-name>CXF Servlet</display-name>
+		<display-name>CXF Servlet</display-name>		
 		<servlet-class>
 			org.apache.cxf.transport.servlet.CXFServlet
 		</servlet-class>
+		<init-param> 
+            <param-name>generate-service-list</param-name> 
+            <param-value>false</param-value> 
+       </init-param> 
 		<load-on-startup>1</load-on-startup>
 	</servlet>
 



Mime
View raw message