Author: eglynn
Date: Wed Nov 29 03:16:33 2006
New Revision: 480520
URL: http://svn.apache.org/viewvc?view=rev&rev=480520
Log:
Fix for interop issue with HTTP 202 responses to oneways with empty entity body
(i.e. not a partial repsonse). Addresses JIRA issue CXF-269.
Modified:
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Modified:
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=480520&r1=480519&r2=480520
==============================================================================
---
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Wed Nov 29 03:16:33 2006
@@ -458,10 +458,9 @@
private void handleResponse() throws IOException {
Exchange exchange = outMessage.getExchange();
int responseCode = getResponseCode(connection);
- if (exchange != null
- && exchange.isOneWay()
- && responseCode != HttpURLConnection.HTTP_ACCEPTED) {
- //oneway operation
+ if (isOneway(exchange)
+ && !isPartialResponse(connection, responseCode)) {
+ // oneway operation without partial response
connection.getInputStream().close();
return;
}
@@ -489,6 +488,25 @@
incomingObserver.onMessage(inMessage);
}
+ }
+
+ /**
+ * @param exchange the exchange in question
+ * @return true iff the exchange indicates a oneway MEP
+ */
+ private boolean isOneway(Exchange exchange) {
+ return exchange != null && exchange.isOneWay();
+ }
+
+ /**
+ * @param connection the connection in question
+ * @param responseCode the response code
+ * @return true if a partial response is pending on the connection
+ */
+ private boolean isPartialResponse(URLConnection connection,
+ int responseCode) {
+ return responseCode == HttpURLConnection.HTTP_ACCEPTED
+ && connection.getContentLength() != 0;
}
/**