[1/2] cxf git commit: [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400
Repository: cxf Updated Branches: refs/heads/2.7.x-fixes 8081b6dfe -> 2b15d7638 [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ca4e9565 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ca4e9565 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ca4e9565 Branch: refs/heads/2.7.x-fixes Commit: ca4e9565c40dbe1e6c0c39e176b89cd158ccc607 Parents: 8081b6d Author: Alessio Soldano Authored: Wed Aug 26 09:38:46 2015 +0200 Committer: Alessio Soldano Committed: Wed Aug 26 11:54:31 2015 +0200 -- .../apache/cxf/transport/http/HTTPConduit.java | 35 +--- 1 file changed, 23 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/ca4e9565/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java -- diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java index 4c14abf..b16009e 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java @@ -1545,28 +1545,39 @@ public abstract class HTTPConduit return false; } -protected void handleResponseInternal() throws IOException { +protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); -int responseCode = getResponseCode(); -if (responseCode == -1) { +int rc = getResponseCode(); +if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { -exchange.put(Message.RESPONSE_CODE, responseCode); +exchange.put(Message.RESPONSE_CODE, rc); } -// This property should be set in case the exceptions should not be handled here -// For example jax rs uses this -boolean noExceptions = MessageUtils.isTrue(outMessage.getContextualProperty( -"org.apache.cxf.transport.no_io_exceptions")); +// "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions +// should not be handled here; for example jax rs uses this -if (responseCode >= 400 && responseCode != 500 && !noExceptions) { - -if (responseCode == 404 || responseCode == 503) { +// "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a +// soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) + +if (rc >= 400 && rc != 500 +&& !MessageUtils.isTrue(outMessage.getContextualProperty("org.apache.cxf.transport.no_io_exceptions")) +&& (rc > 400 || !MessageUtils.isTrue(outMessage + .getContextualProperty("org.apache.cxf.transport.process_fault_on_http_400" { + +if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } -throw new HTTPException(responseCode, getResponseMessage(), url.toURL()); + +throw new HTTPException(rc, getResponseMessage(), url.toURL()); } +return rc; +} + +protected void handleResponseInternal() throws IOException { +Exchange exchange = outMessage.getExchange(); +int responseCode = doProcessResponseCode(); InputStream in = null; // oneway or decoupled twoway calls may expect HTTP 202 with no content
[1/2] cxf git commit: [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400
Repository: cxf Updated Branches: refs/heads/3.0.x-fixes a1b0028a8 -> bf03cdc51 [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1f36ca22 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1f36ca22 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1f36ca22 Branch: refs/heads/3.0.x-fixes Commit: 1f36ca2212cea46a1a842b4770c7614fbb093c84 Parents: a1b0028 Author: Alessio Soldano Authored: Wed Aug 26 09:38:46 2015 +0200 Committer: Alessio Soldano Committed: Wed Aug 26 11:51:09 2015 +0200 -- .../apache/cxf/transport/http/HTTPConduit.java | 35 +--- 1 file changed, 23 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/1f36ca22/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java -- diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java index 737221b..44d9faf 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java @@ -1557,28 +1557,39 @@ public abstract class HTTPConduit return false; } -protected void handleResponseInternal() throws IOException { +protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); -int responseCode = getResponseCode(); -if (responseCode == -1) { +int rc = getResponseCode(); +if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { -exchange.put(Message.RESPONSE_CODE, responseCode); +exchange.put(Message.RESPONSE_CODE, rc); } -// This property should be set in case the exceptions should not be handled here -// For example jax rs uses this -boolean noExceptions = MessageUtils.isTrue(outMessage.getContextualProperty( -"org.apache.cxf.transport.no_io_exceptions")); +// "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions +// should not be handled here; for example jax rs uses this -if (responseCode >= 400 && responseCode != 500 && !noExceptions) { - -if (responseCode == 404 || responseCode == 503) { +// "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a +// soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) + +if (rc >= 400 && rc != 500 +&& !MessageUtils.isTrue(outMessage.getContextualProperty("org.apache.cxf.transport.no_io_exceptions")) +&& (rc > 400 || !MessageUtils.isTrue(outMessage + .getContextualProperty("org.apache.cxf.transport.process_fault_on_http_400" { + +if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } -throw new HTTPException(responseCode, getResponseMessage(), url.toURL()); + +throw new HTTPException(rc, getResponseMessage(), url.toURL()); } +return rc; +} + +protected void handleResponseInternal() throws IOException { +Exchange exchange = outMessage.getExchange(); +int responseCode = doProcessResponseCode(); InputStream in = null; // oneway or decoupled twoway calls may expect HTTP 202 with no content
cxf git commit: [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400
Repository: cxf Updated Branches: refs/heads/master 4005dfa73 -> 2bbdbdab9 [CXF-6198] Adding property for getting SOAPFault for HTTP error code 400 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2bbdbdab Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2bbdbdab Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2bbdbdab Branch: refs/heads/master Commit: 2bbdbdab92befd79e5083cf7a298f6a931a2e76e Parents: 4005dfa Author: Alessio Soldano Authored: Wed Aug 26 09:38:46 2015 +0200 Committer: Alessio Soldano Committed: Wed Aug 26 09:39:48 2015 +0200 -- .../apache/cxf/transport/http/HTTPConduit.java | 35 +--- 1 file changed, 23 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/2bbdbdab/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java -- diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java index 1462a67..ea24009 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java @@ -1554,28 +1554,39 @@ public abstract class HTTPConduit return responseCode == 500 && MessageUtils.getContextualBoolean(message, Message.ROBUST_ONEWAY, false); } -protected void handleResponseInternal() throws IOException { +protected int doProcessResponseCode() throws IOException { Exchange exchange = outMessage.getExchange(); -int responseCode = getResponseCode(); -if (responseCode == -1) { +int rc = getResponseCode(); +if (rc == -1) { LOG.warning("HTTP Response code appears to be corrupted"); } if (exchange != null) { -exchange.put(Message.RESPONSE_CODE, responseCode); +exchange.put(Message.RESPONSE_CODE, rc); } -// This property should be set in case the exceptions should not be handled here -// For example jax rs uses this -boolean noExceptions = MessageUtils.isTrue(outMessage.getContextualProperty( -"org.apache.cxf.transport.no_io_exceptions")); +// "org.apache.cxf.transport.no_io_exceptions" property should be set in case the exceptions +// should not be handled here; for example jax rs uses this -if (responseCode >= 400 && responseCode != 500 && !noExceptions) { - -if (responseCode == 404 || responseCode == 503) { +// "org.apache.cxf.transport.process_fault_on_http_400" property should be set in case a +// soap fault because of a HTTP 400 should be returned back to the client (SOAP 1.2 spec) + +if (rc >= 400 && rc != 500 +&& !MessageUtils.isTrue(outMessage.getContextualProperty("org.apache.cxf.transport.no_io_exceptions")) +&& (rc > 400 || !MessageUtils.isTrue(outMessage + .getContextualProperty("org.apache.cxf.transport.process_fault_on_http_400" { + +if (rc == 404 || rc == 503) { exchange.put("org.apache.cxf.transport.service_not_available", true); } -throw new HTTPException(responseCode, getResponseMessage(), url.toURL()); + +throw new HTTPException(rc, getResponseMessage(), url.toURL()); } +return rc; +} + +protected void handleResponseInternal() throws IOException { +Exchange exchange = outMessage.getExchange(); +int responseCode = doProcessResponseCode(); InputStream in = null; // oneway or decoupled twoway calls may expect HTTP 202 with no content