cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6661] Optional link to a WADL schema location
Date Fri, 06 Nov 2015 12:07:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/master f02749d14 -> fd8f1b894


[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/fd8f1b89
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fd8f1b89
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fd8f1b89

Branch: refs/heads/master
Commit: fd8f1b8947e18e319735397b89220af764918d72
Parents: f02749d
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:06:43 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/fd8f1b89/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 75e63a3..dd1fb26 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
@@ -142,6 +142,11 @@ public class Java2WADLMojo extends AbstractMojo {
     /**
      * @parameter default-value="false"
      */
+    private boolean includeDefaultWadlSchemaLocation;
+    
+    /**
+     * @parameter default-value="false"
+     */
     private boolean ignoreForwardSlash;
     
     /**
@@ -242,6 +247,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/fd8f1b89/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 76159a7..d4ccd83 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
@@ -135,6 +135,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";
@@ -172,7 +173,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;
@@ -374,6 +375,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);
     }
 
@@ -2156,6 +2164,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