cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5934] Introducng few protected methods to make it simpler to override handleOperation
Date Mon, 11 Aug 2014 13:57:54 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 1d6ee7f4f -> da51dfbcc


[CXF-5934] Introducng few protected methods to make it simpler to override handleOperation


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

Branch: refs/heads/2.7.x-fixes
Commit: da51dfbcc285fe327b73dc8b220a79f89f84f98f
Parents: 1d6ee7f
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Aug 11 14:57:29 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Aug 11 14:57:29 2014 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/model/wadl/WadlGenerator.java     | 35 ++++++++++++++++----
 1 file changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/da51dfbc/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
index ca52361..2856519 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
@@ -435,6 +435,27 @@ public class WadlGenerator implements RequestHandler {
         }
         sb.append(">");
     }
+    protected void endMethodTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("</method>");
+    }
+    protected void startMethodRequestTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("<request>");
+    }
+    protected void startMethodResponseTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("<response");
+    }
+    protected void endMethodRequestTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("</request>");
+    }
+    protected void endMethodResponseTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("</response>");
+    }
+    protected void startResourceTag(StringBuilder sb, OperationResourceInfo ori, String path)
{
+        sb.append("<resource path=\"").append(path).append("\">");
+    }
+    protected void endResourceTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("</resource>");
+    }
 
     // CHECKSTYLE:OFF
     protected boolean handleOperation(StringBuilder sb, Set<Class<?>> jaxbTypes,
@@ -456,7 +477,7 @@ public class WadlGenerator implements RequestHandler {
                     path = path.substring(1);
                 }
             }
-            sb.append("<resource path=\"").append(getPath(path)).append("\">");
+            startResourceTag(sb, ori, getPath(path));
             handleDocs(anns, sb, DocTarget.RESOURCE, false, isJson);
             handlePathAndMatrixClassParams(sb, classParams, isJson);
             handlePathAndMatrixParams(sb, ori, isJson);
@@ -468,7 +489,7 @@ public class WadlGenerator implements RequestHandler {
         startMethodTag(sb, ori);
         handleDocs(anns, sb, DocTarget.METHOD, true, isJson);
         if (getMethod(ori).getParameterTypes().length != 0 || classParams.size() != 0) {
-            sb.append("<request>");
+            startMethodRequestTag(sb, ori);
             handleDocs(anns, sb, DocTarget.REQUEST, false, isJson);
 
             boolean isForm = isFormRequest(ori);
@@ -483,9 +504,9 @@ public class WadlGenerator implements RequestHandler {
             if (isForm) {
                 handleFormRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, getFormClass(ori),
isJson);
             }
-            sb.append("</request>");
+            endMethodRequestTag(sb, ori);
         }
-        sb.append("<response");
+        startMethodResponseTag(sb, ori);
         Class<?> returnType = getMethod(ori).getReturnType();
         boolean isVoid = void.class == returnType;
         if (isVoid) {
@@ -497,12 +518,12 @@ public class WadlGenerator implements RequestHandler {
         if (!isVoid) {
             handleRepresentation(sb, jaxbTypes, qnameResolver, clsMap, ori, returnType, isJson,
false);
         }
-        sb.append("</response>");
+        endMethodResponseTag(sb, ori);
 
-        sb.append("</method>");
+        endMethodTag(sb, ori);
 
         if (resourceTagOpened && !samePathOperationFollows) {
-            sb.append("</resource>");
+            endResourceTag(sb, ori);
             resourceTagOpened = false;
         }
         return resourceTagOpened;


Mime
View raw message