Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D364010E56 for ; Fri, 16 Jan 2015 15:47:00 +0000 (UTC) Received: (qmail 21298 invoked by uid 500); 16 Jan 2015 15:47:02 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 21253 invoked by uid 500); 16 Jan 2015 15:47:02 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 21238 invoked by uid 99); 16 Jan 2015 15:47:02 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jan 2015 15:47:02 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 6E1F0AC005A; Fri, 16 Jan 2015 15:47:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1652440 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ chemistry-opencmis-commons/chemistry-opencmis-commons-api/src... Date: Fri, 16 Jan 2015 15:47:02 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150116154702.6E1F0AC005A@hades.apache.org> Author: fmui Date: Fri Jan 16 15:47:01 2015 New Revision: 1652440 URL: http://svn.apache.org/r1652440 Log: Web Services client: added session parameter to control handling of SOAP responses (in-memory vs temp file) Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunJREPortProvider.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunRIPortProvider.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunJREPortProvider.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunJREPortProvider.java?rev=1652440&r1=1652439&r2=1652440&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunJREPortProvider.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunJREPortProvider.java Fri Jan 16 15:47:01 2015 @@ -28,6 +28,7 @@ import javax.xml.ws.WebServiceFeature; import javax.xml.ws.soap.MTOMFeature; import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper; +import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException; @@ -44,12 +45,29 @@ import com.sun.xml.internal.ws.developer /** * Sun JRE JAX-WS implementation. */ +@SuppressWarnings("restriction") public class SunJREPortProvider extends AbstractPortProvider { private static final Logger LOG = LoggerFactory.getLogger(SunJREPortProvider.class); + private int contentThreshold; + private int responseThreshold; + + @Override + public void setSession(BindingSession session) { + super.setSession(session); + + contentThreshold = session.get(SessionParameter.WEBSERVICES_MEMORY_THRESHOLD, 4 * 1024 * 1024); + responseThreshold = session.get(SessionParameter.WEBSERVICES_REPSONSE_MEMORY_THRESHOLD, -1); + + if (responseThreshold > contentThreshold) { + contentThreshold = responseThreshold; + } + } + /** * Creates a port object. */ + @SuppressWarnings("restriction") protected BindingProvider createPortObject(CmisServiceHolder serviceHolder) { if (LOG.isDebugEnabled()) { LOG.debug("Session {}: Creating Web Service port object of {} ...", getSession().getSessionId(), @@ -60,11 +78,15 @@ public class SunJREPortProvider extends // prepare features WebServiceFeature[] features; if (serviceHolder.getService().handlesContent()) { - int threshold = getSession().get(SessionParameter.WEBSERVICES_MEMORY_THRESHOLD, 4 * 1024 * 1024); features = new WebServiceFeature[] { new MTOMFeature(), - new StreamingAttachmentFeature(null, true, threshold) }; + new StreamingAttachmentFeature(null, true, contentThreshold) }; } else { - features = new WebServiceFeature[] { new MTOMFeature() }; + if (responseThreshold > -1) { + features = new WebServiceFeature[] { new MTOMFeature(), + new StreamingAttachmentFeature(null, true, responseThreshold) }; + } else { + features = new WebServiceFeature[] { new MTOMFeature() }; + } } // create port object Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunRIPortProvider.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunRIPortProvider.java?rev=1652440&r1=1652439&r2=1652440&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunRIPortProvider.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunRIPortProvider.java Fri Jan 16 15:47:01 2015 @@ -28,6 +28,7 @@ import javax.xml.ws.WebServiceFeature; import javax.xml.ws.soap.MTOMFeature; import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper; +import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException; @@ -47,6 +48,21 @@ import com.sun.xml.ws.developer.WSBindin public class SunRIPortProvider extends AbstractPortProvider { private static final Logger LOG = LoggerFactory.getLogger(SunRIPortProvider.class); + private int contentThreshold; + private int responseThreshold; + + @Override + public void setSession(BindingSession session) { + super.setSession(session); + + contentThreshold = session.get(SessionParameter.WEBSERVICES_MEMORY_THRESHOLD, 4 * 1024 * 1024); + responseThreshold = session.get(SessionParameter.WEBSERVICES_REPSONSE_MEMORY_THRESHOLD, -1); + + if (responseThreshold > contentThreshold) { + contentThreshold = responseThreshold; + } + } + /** * Creates a port object. */ @@ -60,11 +76,15 @@ public class SunRIPortProvider extends A // prepare features WebServiceFeature[] features; if (serviceHolder.getService().handlesContent()) { - int threshold = getSession().get(SessionParameter.WEBSERVICES_MEMORY_THRESHOLD, 4 * 1024 * 1024); features = new WebServiceFeature[] { new MTOMFeature(), - new StreamingAttachmentFeature(null, true, threshold) }; + new StreamingAttachmentFeature(null, true, contentThreshold) }; } else { - features = new WebServiceFeature[] { new MTOMFeature() }; + if (responseThreshold > -1) { + features = new WebServiceFeature[] { new MTOMFeature(), + new StreamingAttachmentFeature(null, true, responseThreshold) }; + } else { + features = new WebServiceFeature[] { new MTOMFeature() }; + } } // create port object Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java?rev=1652440&r1=1652439&r2=1652440&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java Fri Jan 16 15:47:01 2015 @@ -484,6 +484,15 @@ package org.apache.chemistry.opencmis.co * 4194304 (4MB) * * + * {@link #WEBSERVICES_REPSONSE_MEMORY_THRESHOLD} + * Web Service responses (XML SOAP parts) smaller than the threshold are + * kept in main memory, larger responses are written to a temporary file + * Web Services + * size in bytes + * no + * (JAX-WS implementation default) + * + * * Browser Binding * * @@ -595,6 +604,7 @@ public final class SessionParameter { public static final String WEBSERVICES_ACL_SERVICE_ENDPOINT = "org.apache.chemistry.opencmis.binding.webservices.ACLService.endpoint"; public static final String WEBSERVICES_MEMORY_THRESHOLD = "org.apache.chemistry.opencmis.binding.webservices.memoryThreshold"; + public static final String WEBSERVICES_REPSONSE_MEMORY_THRESHOLD = "org.apache.chemistry.opencmis.binding.webservices.responseMemoryThreshold"; public static final String WEBSERVICES_PORT_PROVIDER_CLASS = "org.apache.chemistry.opencmis.binding.webservices.portprovider.classname";