cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r590002 - in /incubator/cxf/trunk: rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/src/test/java/org/apache/cxf/systest/servlet/
Date Tue, 30 Oct 2007 09:21:05 GMT
Author: ningjiang
Date: Tue Oct 30 02:21:04 2007
New Revision: 590002

URL: http://svn.apache.org/viewvc?rev=590002&view=rev
Log:
CXF-1143 changed the flage with Glen's suggestion, also fixed a NPE of CXF-1072

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=590002&r1=590001&r2=590002&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
Tue Oct 30 02:21:04 2007
@@ -49,6 +49,7 @@
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.io.InputStreamResource;
 
+
 /**
  * A Servlet which supports loading of JAX-WS endpoints from an
  * XML file and handling requests for endpoints created via other means
@@ -63,13 +64,15 @@
     private Bus bus;
     private ServletTransportFactory servletTransportFactory;
     private ServletController controller;
-    private GenericApplicationContext childCtx;
-
+    private Object childCtx;
+    private Object reader;
+    
+   
     public ServletController createServletController(ServletConfig servletConfig) {
-        String generateServiceList = servletConfig.getInitParameter("generate-service-list");
+        String hideServiceList = servletConfig.getInitParameter("hide-service-list-page");
         ServletController newController = new ServletController(servletTransportFactory,
this);
-        if (generateServiceList != null) {
-            newController.setGenerateServiceList(Boolean.valueOf(generateServiceList));
+        if (hideServiceList != null) {
+            newController.setHideServiceList(Boolean.valueOf(hideServiceList));
         }    
         return newController;
     }
@@ -123,11 +126,10 @@
         ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
         resourceManager.addResourceResolver(new ServletContextResourceResolver(
                                                servletConfig.getServletContext()));
-        
+                        
+        replaceDestinationFactory();
         // Set up the ServletController
         controller = createServletController(servletConfig);
-
-        replaceDestinationFactory();
         
     }
 
@@ -176,7 +178,7 @@
         loadAdditionalConfig(ctx, servletConfig);
     }
 
-    protected void loadAdditionalConfig(ApplicationContext ctx, 
+    private void loadAdditionalConfig(ApplicationContext ctx, 
                                         ServletConfig servletConfig) throws ServletException
{
         String location = servletConfig.getInitParameter("config-location");
         if (location == null) {
@@ -201,11 +203,13 @@
             LOG.log(Level.INFO, "BUILD_ENDPOINTS_FROM_CONFIG_LOCATION", new Object[]{location});
             childCtx = new GenericApplicationContext(ctx);
             
-            XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(childCtx);
-            reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
-            reader.loadBeanDefinitions(new InputStreamResource(is, location));
+            reader = 
+                new XmlBeanDefinitionReader(
+                    (GenericApplicationContext)childCtx);
+            ((XmlBeanDefinitionReader)reader).setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
+            ((XmlBeanDefinitionReader)reader).loadBeanDefinitions(new InputStreamResource(is,
location));
             
-            childCtx.refresh();
+            ((GenericApplicationContext)childCtx).refresh();
         } 
     }
 
@@ -249,7 +253,7 @@
 
     public void destroy() {
         if (childCtx != null) {
-            childCtx.destroy();
+            ((GenericApplicationContext)childCtx).destroy();
         }
         
         String s = bus.getId();

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=590002&r1=590001&r2=590002&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
Tue Oct 30 02:21:04 2007
@@ -54,15 +54,15 @@
     private ServletTransportFactory transport;
     private CXFServlet cxfServlet;
     private String lastBase = "";
-    private boolean isGenerateServiceList = true;
+    private boolean isHideServiceList;
  
     public ServletController(ServletTransportFactory df, CXFServlet servlet) {
         this.transport = df;
         this.cxfServlet = servlet;       
     }
     
-    public void setGenerateServiceList(boolean generate) {
-        isGenerateServiceList = generate;
+    public void setHideServiceList(boolean generate) {
+        isHideServiceList = generate;
     }
     
     private synchronized void updateDests(HttpServletRequest request) {
@@ -170,7 +170,7 @@
         Collection<ServletDestination> destinations = transport.getDestinations();
         response.setContentType("text/html");        
         response.getWriter().write("<html><body>");
-        if (isGenerateServiceList) {
+        if (!isHideServiceList) {
             if (destinations.size() > 0) {  
                 for (ServletDestination sd : destinations) {
                     if (null != sd.getEndpointInfo().getName()) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml?rev=590002&r1=590001&r2=590002&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-spring.xml
Tue Oct 30 02:21:04 2007
@@ -44,8 +44,8 @@
 			org.apache.cxf.transport.servlet.CXFServlet
 		</servlet-class>
 		<init-param> 
-            <param-name>generate-service-list</param-name> 
-            <param-value>false</param-value> 
+            <param-name>hide-service-list-page</param-name> 
+            <param-value>true</param-value> 
        </init-param> 
 		<load-on-startup>1</load-on-startup>
 	</servlet>



Mime
View raw message