You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/09/14 19:25:55 UTC
svn commit: r997003 - in /cxf/branches/2.2.x-fixes: ./
api/src/main/java/org/apache/cxf/endpoint/Client.java
api/src/main/java/org/apache/cxf/message/Message.java
rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Author: dkulp
Date: Tue Sep 14 17:25:55 2010
New Revision: 997003
URL: http://svn.apache.org/viewvc?rev=997003&view=rev
Log:
Merged revisions 996820 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r996820 | ema | 2010-09-14 06:32:55 -0400 (Tue, 14 Sep 2010) | 1 line
[CXF-2991]:Refactor the code. Thanks Dan for reviewing the code and his suggestions
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java?rev=997003&r1=997002&r2=997003&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/endpoint/Client.java Tue Sep 14 17:25:55 2010
@@ -34,8 +34,6 @@ public interface Client extends Intercep
String REQUEST_CONTEXT = "RequestContext";
String RESPONSE_CONTEXT = "ResponseContext";
String KEEP_CONDUIT_ALIVE = "KeepConduitAlive";
- String CONNECTION_TIMEOUT = "javax.xml.ws.client.connectionTimeout";
- String RECEIVE_TIMEOUT = "javax.xml.ws.client.receiveTimeout";
/**
* Invokes an operation synchronously
Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java?rev=997003&r1=997002&r2=997003&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/message/Message.java Tue Sep 14 17:25:55 2010
@@ -116,7 +116,13 @@ public interface Message extends StringM
* As above, but Collection<InterceptorProvider>
*/
String INTERCEPTOR_PROVIDERS = Message.class.getName() + ".INTERCEPTOR_PROVIDER";
-
+
+ /*
+ * The properties to allow configure the client timeout
+ */
+ String CONNECTION_TIMEOUT = "javax.xml.ws.client.connectionTimeout";
+ String RECEIVE_TIMEOUT = "javax.xml.ws.client.receiveTimeout";
+
String getId();
void setId(String id);
Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=997003&r1=997002&r2=997003&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java Tue Sep 14 17:25:55 2010
@@ -54,7 +54,6 @@ import org.apache.cxf.configuration.jsse
import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.configuration.security.CertificateConstraintsType;
import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
-import org.apache.cxf.endpoint.Client;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.HttpHeaderHelper;
import org.apache.cxf.helpers.IOUtils;
@@ -504,39 +503,35 @@ public class HTTPConduit
HttpURLConnectionFactory f = getConnectionFactory(currentURL);
HttpURLConnection connection = f.createConnection(getProxy(csPolicy), currentURL);
connection.setDoOutput(true);
- Map<String, Object> ctx = CastUtils.cast((Map<?, ?>)message.get(Message.INVOCATION_CONTEXT));
- if (ctx != null) {
- Map<String, Object> reqCtx = CastUtils.cast((Map<?, ?>)ctx.get(Client.REQUEST_CONTEXT));
- if (reqCtx != null && reqCtx.get(Client.RECEIVE_TIMEOUT) != null) {
- Object obj = reqCtx.get(Client.RECEIVE_TIMEOUT);
- try {
- csPolicy.setReceiveTimeout(Long.parseLong(obj.toString()));
- } catch (NumberFormatException e) {
- LOG.log(Level.WARNING, "INVALID_TIMEOUT_FORMAT", new Object[] {
- Client.RECEIVE_TIMEOUT, obj.toString()
- });
- }
-
- }
- if (reqCtx != null && reqCtx.get(Client.CONNECTION_TIMEOUT) != null) {
- Object obj = reqCtx.get(Client.CONNECTION_TIMEOUT);
- try {
- csPolicy.setReceiveTimeout(Long.parseLong(obj.toString()));
- } catch (NumberFormatException e) {
- LOG.log(Level.WARNING, "INVALID_TIMEOUT_FORMAT", new Object[] {
- Client.CONNECTION_TIMEOUT, obj.toString()
- });
- }
-
- }
- }
long timeout = csPolicy.getConnectionTimeout();
+ if (message.get(Message.CONNECTION_TIMEOUT) != null) {
+ Object obj = message.get(Message.CONNECTION_TIMEOUT);
+ try {
+ timeout = Long.parseLong(obj.toString());
+ } catch (NumberFormatException e) {
+ LOG.log(Level.WARNING, "INVALID_TIMEOUT_FORMAT", new Object[] {
+ Message.CONNECTION_TIMEOUT, obj.toString()
+ });
+ }
+ }
if (timeout > Integer.MAX_VALUE) {
timeout = Integer.MAX_VALUE;
}
+
connection.setConnectTimeout((int)timeout);
+
timeout = csPolicy.getReceiveTimeout();
+ if (message.get(Message.RECEIVE_TIMEOUT) != null) {
+ Object obj = message.get(Message.RECEIVE_TIMEOUT);
+ try {
+ timeout = Long.parseLong(obj.toString());
+ } catch (NumberFormatException e) {
+ LOG.log(Level.WARNING, "INVALID_TIMEOUT_FORMAT", new Object[] {
+ Message.RECEIVE_TIMEOUT, obj.toString()
+ });
+ }
+ }
if (timeout > Integer.MAX_VALUE) {
timeout = Integer.MAX_VALUE;
}