cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5475] Updates to get a correct WADL file name produced
Date Mon, 09 Jun 2014 10:20:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 727baf1f0 -> 266b0d6d9


[CXF-5475] Updates to get a correct WADL file name produced


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

Branch: refs/heads/master
Commit: 266b0d6d9997961f3782b08a4fa28607229f7de9
Parents: 727baf1
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Jun 9 11:20:20 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Jun 9 11:20:20 2014 +0100

----------------------------------------------------------------------
 .../maven_plugin/javatowadl/Java2WADLMojo.java  | 33 ++++++++++++++++----
 .../cxf/jaxrs/model/wadl/WadlGenerator.java     |  2 +-
 2 files changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/266b0d6d/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 f9053fe..b525e82 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
@@ -159,6 +159,16 @@ public class Java2WADLMojo extends AbstractMojo {
      */
     private String namespacePrefix;
     
+    /**
+     * @parameter 
+     */
+    private String outputFileName;
+    
+    /**
+     * @parameter default-value="wadl"
+     */
+    private String outputFileExtension;
+    
     public void execute() throws MojoExecutionException {
         
         getResourcesList();
@@ -201,11 +211,21 @@ public class Java2WADLMojo extends AbstractMojo {
      
         if (outputFile == null && project != null) {
             // Put the wadl in target/generated/wadl
-            String className = classResourceNames.get(0);
-            int i = className.lastIndexOf('.');
-            String name = className.substring(i + 1);
-            outputFile = (project.getBuild().getDirectory() + "/generated/wadl/" + name +
".wadl")
-                .replace("/", File.separator);
+            
+            String name = null;
+            if (outputFileName != null) {
+                name = outputFileName;
+            } else if (applicationTitle != null) {
+                name = applicationTitle.replaceAll(" ", "");    
+            } else if (classResourceNames.size() == 1) {
+                String className = classResourceNames.get(0);
+                int i = className.lastIndexOf('.');
+                name = className.substring(i + 1);
+            } else {
+                name = "application";
+            }
+            outputFile = (project.getBuild().getDirectory() + "/generated/wadl/" + name +
"." 
+                + outputFileExtension).replace("/", File.separator);
         }
         
         BufferedWriter writer = null;
@@ -248,7 +268,8 @@ public class Java2WADLMojo extends AbstractMojo {
         if (address != null) {
             return address;
         } else {
-            return "http://localhost/cxf/";
+            // the consumer may use the original target URI to figure out absolute URI 
+            return "/";
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/266b0d6d/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 e9ec2ba..2f7d79d 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
@@ -1605,7 +1605,7 @@ public class WadlGenerator implements ContainerRequestFilter {
             return new ExternalSchemaWriter(externalSchemaLinks, ui);
         } else if (externalSchemasCache != null) {
             return new StringSchemaWriter(externalSchemasCache, externalSchemaLinks, ui);
-        } else if (context != null) {
+        } else {
             SchemaCollection coll = getSchemaCollection(resourceTypes, context);
             if (coll != null) {
                 return new SchemaCollectionWriter(coll);


Mime
View raw message