cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [2/2] cxf git commit: [CXF-6661] Optional link to a WADL schema location
Date Fri, 06 Nov 2015 12:11:35 GMT
[CXF-6661] Optional link to a WADL schema location


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/30aac3d3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/30aac3d3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/30aac3d3

Branch: refs/heads/3.0.x-fixes
Commit: 30aac3d324ddf62633df56ba0a89f5428d4689d0
Parents: 53f4952
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Nov 6 12:06:43 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Nov 6 12:11:17 2015 +0000

----------------------------------------------------------------------
 .../maven_plugin/javatowadl/Java2WADLMojo.java    |  6 ++++++
 .../cxf/jaxrs/model/wadl/WadlGenerator.java       | 18 +++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/30aac3d3/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
index ff5a782..81e231c 100644
--- a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
+++ b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/Java2WADLMojo.java
@@ -141,6 +141,11 @@ public class Java2WADLMojo extends AbstractMojo {
     /**
      * @parameter default-value="false"
      */
+    private boolean includeDefaultWadlSchemaLocation;
+    
+    /**
+     * @parameter default-value="false"
+     */
     private boolean ignoreForwardSlash;
     
     /**
@@ -240,6 +245,7 @@ public class Java2WADLMojo extends AbstractMojo {
     private void setExtraProperties(WadlGenerator wg) {
         wg.setSingleResourceMultipleMethods(singleResourceMultipleMethods);
         wg.setUseSingleSlashResource(useSingleSlashResource);
+        wg.setIncludeDefaultWadlSchemaLocation(includeDefaultWadlSchemaLocation);
         wg.setIgnoreForwardSlash(ignoreForwardSlash);
         wg.setAddResourceAndMethodIds(addResourceAndMethodIds);
         wg.setLinkAnyMediaTypeToXmlSchema(linkAnyMediaTypeToXmlSchema);

http://git-wip-us.apache.org/repos/asf/cxf/blob/30aac3d3/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index 8b77ab4..3942fba 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -136,6 +136,7 @@ public class WadlGenerator implements ContainerRequestFilter {
     public static final String WADL_QUERY = "_wadl";
     public static final MediaType WADL_TYPE = JAXRSUtils.toMediaType("application/vnd.sun.wadl+xml");
     public static final String WADL_NS = "http://wadl.dev.java.net/2009/02";
+    public static final String DEFAULT_WADL_SCHEMA_LOC = "http://www.w3.org/Submission/wadl/wadl.xsd";
 
     private static final Logger LOG = LogUtils.getL7dLogger(WadlGenerator.class);
     private static final String CONVERT_WADL_RESOURCES_TO_DOM = "convert.wadl.resources.to.dom";
@@ -173,7 +174,7 @@ public class WadlGenerator implements ContainerRequestFilter {
     private boolean ignoreMessageWriters = true;
     private boolean ignoreRequests;
     private boolean convertResourcesToDOM = true;
-    
+    private String wadlSchemaLocation;
     private List<String> externalSchemasCache;
     private List<URI> externalSchemaLinks;
     private Map<String, List<String>> externalQnamesMap;
@@ -375,6 +376,13 @@ public class WadlGenerator implements ContainerRequestFilter {
                 .append("\"");
         }
 
+        if (wadlSchemaLocation != null) {
+            sbApp.append(" xmlns:xsi=\"").append(Constants.URI_2001_SCHEMA_XSI).append("\"");
+            sbApp.append(" xsi:schemaLocation=\"")
+                 .append(getNamespace()).append(" ").append(wadlSchemaLocation)
+                 .append("\"");
+        }
+        
         writer.write(sbGrammars);
     }
 
@@ -2158,6 +2166,14 @@ public class WadlGenerator implements ContainerRequestFilter {
     public void setStylesheetReference(String stylesheetReference) {
         this.stylesheetReference = stylesheetReference;
     }
+    public void setIncludeWadlSchemaLocation(String loc) {
+        this.wadlSchemaLocation = loc;
+    }
+    public void setIncludeDefaultWadlSchemaLocation(boolean inc) {
+        if (inc) {
+            setIncludeWadlSchemaLocation(DEFAULT_WADL_SCHEMA_LOC);
+        }
+    }
 
     public void setIgnoreOverloadedMethods(boolean ignore) {
         this.ignoreOverloadedMethods = ignore;


Mime
View raw message