You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2021/06/01 17:52:36 UTC

[cxf] branch master updated: [CXF-8546]introduce a property so that we can configure writeOptionalTypeParameters

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new b8cbeb5  [CXF-8546]introduce a property so that we can configure writeOptionalTypeParameters
b8cbeb5 is described below

commit b8cbeb5f643009f67673d5f0244225fcf1b8e372
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Jun 1 13:52:20 2021 -0400

    [CXF-8546]introduce a property so that we can configure writeOptionalTypeParameters
---
 .../java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java b/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
index e41a826..0e0b4dc 100644
--- a/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/interceptor/AttachmentOutInterceptor.java
@@ -39,10 +39,14 @@ public class AttachmentOutInterceptor extends AbstractPhaseInterceptor<Message>
     public static final String WRITE_ATTACHMENTS = "write.attachments";
     
     public static final String ATTACHMENT_OUT_CHECKED = "attachment.out.checked";
+    
+    public static final String WRITE_OPTIONAL_TYPE_PARAMETERS = "write.optional.type.parameters";
 
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(AttachmentOutInterceptor.class);
 
     private AttachmentOutEndingInterceptor ending = new AttachmentOutEndingInterceptor();
+    
+    private boolean writeOptionalTypeParameters = true;
 
     public AttachmentOutInterceptor() {
         super(Phase.PRE_STREAM);
@@ -63,6 +67,7 @@ public class AttachmentOutInterceptor extends AbstractPhaseInterceptor<Message>
         boolean writeAtts = MessageUtils.getContextualBoolean(message, WRITE_ATTACHMENTS, false)
             || (message.getAttachments() != null && !message.getAttachments().isEmpty());
 
+        writeOptionalTypeParameters = MessageUtils.getContextualBoolean(message, WRITE_OPTIONAL_TYPE_PARAMETERS, true);
         if (!mtomEnabled && !writeAtts) {
             return;
         }
@@ -98,7 +103,7 @@ public class AttachmentOutInterceptor extends AbstractPhaseInterceptor<Message>
     }
 
     protected boolean writeOptionalTypeParameters() {
-        return true;
+        return writeOptionalTypeParameters;
     }
 
     protected Map<String, List<String>> getRootHeaders() {