cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1308794 - in /cxf/branches/2.5.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Date Tue, 03 Apr 2012 09:56:30 GMT
Author: sergeyb
Date: Tue Apr  3 09:56:29 2012
New Revision: 1308794

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

........
  r1308793 | sergeyb | 2012-04-03 12:52:14 +0300 (Tue, 03 Apr 2012) | 1 line
  
  [CXF-4220] Updates to WADLGenerator to avoid duplicate slashes in modified schemaLocations
and ignore empty schemaLocations
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
    cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1308793

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

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1308794&r1=1308793&r2=1308794&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Tue Apr  3 09:56:29 2012
@@ -882,9 +882,12 @@ public class WadlGenerator implements Re
         
         for (Element schemaRefEl : schemaRefEls) {
             String href = schemaRefEl.getAttribute(attrName);
-            String actualRef = parentRef + href;
-            schemaLocationMap.put(actualRef, parentDocLoc + href);    
-            DOMUtils.setAttribute(schemaRefEl, attrName, getBaseURI(ui) + "/" + actualRef);
+            if (!StringUtils.isEmpty(href)) {
+                String actualRef = parentRef + href;
+                schemaLocationMap.put(actualRef, parentDocLoc + href);   
+                URI schemaURI = ui.getBaseUriBuilder().path(actualRef).build();
+                DOMUtils.setAttribute(schemaRefEl, attrName, schemaURI.toString());
+            }
         }
     }
 

Modified: cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1308794&r1=1308793&r2=1308794&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Tue Apr  3 09:56:29 2012
@@ -64,6 +64,7 @@ public class CXFNonSpringJaxrsServlet ex
     private static final String LANGUAGES_PARAM = "jaxrs.languages";
     private static final String PROPERTIES_PARAM = "jaxrs.properties";
     private static final String SCHEMAS_PARAM = "jaxrs.schemaLocations";
+    private static final String DOC_LOCATION_PARAM = "jaxrs.documentLocation";
     private static final String STATIC_SUB_RESOLUTION_PARAM = "jaxrs.static.subresources";
     private static final String SERVICE_SCOPE_SINGLETON = "singleton";
     private static final String SERVICE_SCOPE_REQUEST = "prototype";
@@ -95,7 +96,7 @@ public class CXFNonSpringJaxrsServlet ex
         if (modelRef != null) {
             bean.setModelRef(modelRef.trim());
         }
-        
+        setDocLocation(bean, servletConfig);
         setSchemasLocations(bean, servletConfig);
         setAllInterceptors(bean, servletConfig);
         
@@ -173,6 +174,13 @@ public class CXFNonSpringJaxrsServlet ex
         }
     }
     
+    protected void setDocLocation(JAXRSServerFactoryBean bean, ServletConfig servletConfig)
{
+        String wadlLoc = servletConfig.getInitParameter(DOC_LOCATION_PARAM);
+        if (wadlLoc != null) {
+            bean.setDocLocation(wadlLoc);
+        }
+    }
+    
     @SuppressWarnings("unchecked")
     protected void setInterceptors(JAXRSServerFactoryBean bean, ServletConfig servletConfig,
                                    String paramName) {
@@ -364,6 +372,7 @@ public class CXFNonSpringJaxrsServlet ex
                                             getStaticSubResolutionValue(servletConfig));
         setAllInterceptors(bean, servletConfig);
         setExtensions(bean, servletConfig);
+        setDocLocation(bean, servletConfig);
         setSchemasLocations(bean, servletConfig);
         
         bean.setBus(getBus());

Modified: cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1308794&r1=1308793&r2=1308794&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/branches/2.5.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Tue Apr  3 09:56:29 2012
@@ -65,7 +65,7 @@ public class JAXRSClientServerSpringBook
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", 
-                   launchServer(BookServerSpring.class, true));
+                   launchServer(BookServerSpring.class));
     }
     
     @Test
@@ -113,6 +113,7 @@ public class JAXRSClientServerSpringBook
     
         checkSchemas(address, "/book.xsd", "/bookid.xsd", "import");
         checkSchemas(address, "/bookid.xsd", null, null);
+        checkWadlResourcesInfo(address, address, "/book.xsd", 1);
     }
     
     private void checkSchemas(String address, String schemaSegment, 



Mime
View raw message