cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r750663 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ systests/src/test/resources/jaxrs_atom/WEB-...
Date Thu, 05 Mar 2009 23:07:05 GMT
Author: sergeyb
Date: Thu Mar  5 23:07:05 2009
New Revision: 750663

URL: http://svn.apache.org/viewvc?rev=750663&view=rev
Log:
Minor updates to do with output buffering

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SystemUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
    cxf/trunk/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SystemUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SystemUtils.java?rev=750663&r1=750662&r2=750663&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SystemUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/SystemUtils.java Thu
Mar  5 23:07:05 2009
@@ -25,7 +25,6 @@
  */
 public final class SystemUtils {
     
-    public static final String OUT_BUFFERING = "org.apache.cxf.output.buffering";
     public static final String SPRING_VALIDATION_MODE = "org.apache.cxf.spring.validation.mode";
     
     private SystemUtils() {
@@ -33,22 +32,6 @@
     }
 
     /**
-     * Checks org.apache.cxf.output.buffering property value, defaults to false 
-     * @return true if output buffering is enabled
-     */
-    public static boolean isBufferingEnabled() { 
-        return Boolean.getBoolean(System.getProperty(OUT_BUFFERING, "false"));    
-    }
-    
-    /**
-     * Checks if org.apache.cxf.output.buffering property was explicitly set 
-     * @return true if it was set
-     */
-    public static boolean isBufferingSet() { 
-        return System.getProperty(OUT_BUFFERING) != null;    
-    }
-    
-    /**
      * Gets org.apache.cxf.spring.validation.mode property value if available 
      * @return Spring validation mode
      */

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java?rev=750663&r1=750662&r2=750663&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
Thu Mar  5 23:07:05 2009
@@ -29,7 +29,6 @@
 import javax.xml.stream.events.XMLEvent;
 import javax.xml.validation.Schema;
 
-import org.apache.cxf.common.util.SystemUtils;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Attachment;
@@ -49,7 +48,7 @@
 public abstract class AbstractOutDatabindingInterceptor extends AbstractPhaseInterceptor<Message>
{
 
     public static final String DISABLE_OUTPUTSTREAM_OPTIMIZATION = "disable.outputstream.optimization";
-    
+    public static final String OUT_BUFFERING = "org.apache.cxf.output.buffering";
     
     public AbstractOutDatabindingInterceptor(String phase) {
         super(phase);
@@ -75,7 +74,7 @@
         
         // need to cache the events in case validation fails or buffering is enabled
         if (shouldValidate(message) && !isRequestor(message)
-            || SystemUtils.isBufferingEnabled()) {
+            || isBufferingEnabled(message)) {
             cache = new CachingXmlEventWriter();
             try {
                 cache.setNamespaceContext(origXmlWriter.getNamespaceContext());
@@ -128,6 +127,11 @@
     }
     
     
+    protected boolean isBufferingEnabled(Message m) {
+        Object en = m.getContextualProperty(OUT_BUFFERING);
+        return Boolean.TRUE.equals(en) || "true".equals(en);
+    }
+    
     protected boolean shouldValidate(Message m) {
         Object en = m.getContextualProperty(Message.SCHEMA_VALIDATION_ENABLED);
         return Boolean.TRUE.equals(en) || "true".equals(en);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=750663&r1=750662&r2=750663&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
Thu Mar  5 23:07:05 2009
@@ -38,7 +38,6 @@
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.SystemUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.ext.ResponseHandler;
@@ -202,8 +201,9 @@
         if (!firstTry) {
             return false;
         }
-        boolean enabled = SystemUtils.isBufferingEnabled();
-        if (!enabled && !SystemUtils.isBufferingSet()) {
+        Object outBuf = m.getContextualProperty(OUT_BUFFERING);
+        boolean enabled = Boolean.TRUE.equals(outBuf) || "true".equals(outBuf);
+        if (!enabled && outBuf == null) {
             enabled = InjectionUtils.invokeBooleanGetter(w, "getEnableBuffering");
         }
         if (enabled) {

Modified: cxf/trunk/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml?rev=750663&r1=750662&r2=750663&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/src/test/resources/jaxrs_atom/WEB-INF/beans.xml Thu Mar  5 23:07:05
2009
@@ -80,6 +80,9 @@
     <jaxrs:extensionMappings>
       <entry key="json" value="application/json"/>
     </jaxrs:extensionMappings>	
+    <jaxrs:properties>
+       <entry key="org.apache.cxf.output.buffering" value="true"/>
+    </jaxrs:properties>
   </jaxrs:server>
   
   <bean id="atomstore" class="org.apache.cxf.systest.jaxrs.AtomBookStore"/>



Mime
View raw message