chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1085311 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/...
Date Fri, 25 Mar 2011 10:44:49 GMT
Author: fmui
Date: Fri Mar 25 10:44:49 2011
New Revision: 1085311

URL: http://svn.apache.org/viewvc?rev=1085311&view=rev
Log:
- add read and connect timeouts

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.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/atompub/HttpUtils.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/atompub/HttpUtils.java?rev=1085311&r1=1085310&r2=1085311&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
Fri Mar 25 10:44:49 2011
@@ -68,7 +68,8 @@ public class HttpUtils {
         return invoke(url, "POST", contentType, null, writer, session, null, null);
     }
 
-    public static Response invokePUT(UrlBuilder url, String contentType, Map<String, String>
headers, Output writer, Session session) {
+    public static Response invokePUT(UrlBuilder url, String contentType, Map<String, String>
headers, Output writer,
+            Session session) {
         return invoke(url, "PUT", contentType, headers, writer, session, null, null);
     }
 
@@ -76,9 +77,8 @@ public class HttpUtils {
         return invoke(url, "DELETE", null, null, null, session, null, null);
     }
 
-    private static Response invoke(UrlBuilder url, String method,
-            String contentType, Map<String, String> headers, Output writer,
-            Session session, BigInteger offset, BigInteger length) {
+    private static Response invoke(UrlBuilder url, String method, String contentType, Map<String,
String> headers,
+            Output writer, Session session, BigInteger offset, BigInteger length) {
         try {
             // log before connect
             if (log.isDebugEnabled()) {
@@ -92,6 +92,17 @@ public class HttpUtils {
             conn.setDoOutput(writer != null);
             conn.setRequestProperty("User-Agent", "Apache Chemistry OpenCMIS");
 
+            // timeouts
+            int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1);
+            if (connectTimeout >= 0) {
+                conn.setConnectTimeout(connectTimeout);
+            }
+
+            int readTimeout = session.get(SessionParameter.READ_TIMEOUT, -1);
+            if (readTimeout >= 0) {
+                conn.setReadTimeout(readTimeout);
+            }
+
             // set content type
             if (contentType != null) {
                 conn.setRequestProperty("Content-Type", contentType);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.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/PortProvider.java?rev=1085311&r1=1085310&r2=1085311&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
Fri Mar 25 10:44:49 2011
@@ -170,6 +170,18 @@ public class PortProvider extends Abstra
                         .put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
             }
 
+            // timeouts
+            int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1);
+            if (connectTimeout >= 0) {
+                ((BindingProvider) portObject).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT,
connectTimeout);
+            }
+
+            int readTimeout = session.get(SessionParameter.READ_TIMEOUT, -1);
+            if (readTimeout >= 0) {
+                ((BindingProvider) portObject).getRequestContext()
+                        .put("com.sun.xml.ws.request.timeout", connectTimeout);
+            }
+
         } catch (CmisBaseException ce) {
             throw ce;
         } catch (Exception e) {

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=1085311&r1=1085310&r2=1085311&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 Mar 25 10:44:49 2011
@@ -72,7 +72,10 @@ public final class SessionParameter {
     public static final String AUTH_SOAP_USERNAMETOKEN = "org.apache.chemistry.opencmis.binding.auth.soap.usernametoken";
 
     public static final String COMPRESSION = "org.apache.chemistry.opencmis.binding.compression";
-    
+
+    public static final String CONNECT_TIMEOUT = "org.apache.chemistry.opencmis.binding.connecttimeout";
+    public static final String READ_TIMEOUT = "org.apache.chemistry.opencmis.binding.readtimeout";
+
     public static final String CACHE_SIZE_OBJECTS = "org.apache.chemistry.opencmis.cache.objects.size";
     public static final String CACHE_TTL_OBJECTS = "org.apache.chemistry.opencmis.cache.objects.ttl";
     public static final String CACHE_SIZE_PATHTOID = "org.apache.chemistry.opencmis.cache.pathtoid.size";



Mime
View raw message