cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] git commit: Workaround to get the exceptional responses ignored by XML security out interceptors
Date Thu, 20 Feb 2014 17:24:52 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 3085f0fb4 -> 2841fc7c2


Workaround to get the exceptional responses ignored by XML security out interceptors


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c4b5bf8b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c4b5bf8b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c4b5bf8b

Branch: refs/heads/master
Commit: c4b5bf8b52a7d83a5047c145ca20b37ee608c216
Parents: 2be0649
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Feb 20 17:23:39 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Feb 20 17:23:39 2014 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java    | 1 +
 .../cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java       | 3 +++
 .../org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java    | 5 +++++
 .../apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java  | 4 ----
 4 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c4b5bf8b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
index e382712..9c140fa 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
@@ -227,6 +227,7 @@ public class JAXRSInInterceptor extends AbstractPhaseInterceptor<Message>
{
                 : ExceptionUtils.toInternalServerErrorException(ex, null);
         }
         message.getExchange().put(Response.class, excResponse);
+        message.getExchange().put(Throwable.class, ex);
     }
     
     private void setExchangeProperties(Message message, OperationResourceInfo ori, 

http://git-wip-us.apache.org/repos/asf/cxf/blob/c4b5bf8b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
index 884962b..61a30cd 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
@@ -56,6 +56,9 @@ public abstract class AbstractXmlSecOutInterceptor extends AbstractPhaseIntercep
     } 
 
     public void handleMessage(Message message) throws Fault {
+        if (message.getExchange().get(Throwable.class) != null) {
+            return;
+        }
         try {
             Document doc = getDomDocument(message);
             if (doc == null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c4b5bf8b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
index f9f7a6a..aa6f381 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
@@ -102,6 +102,11 @@ public class XmlSecOutInterceptor implements PhaseInterceptor<Message>
{
     }
 
     public void handleMessage(Message message) throws Fault {
+        
+        if (message.getExchange().get(Throwable.class) != null) {
+            return;
+        }
+        
         OutputStream os = message.getContent(OutputStream.class);
         String encoding = getEncoding(message);
         

http://git-wip-us.apache.org/repos/asf/cxf/blob/c4b5bf8b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
index e2e2f25..68c8047 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/xml/JAXRSXmlSecTest.java
@@ -347,10 +347,6 @@ public class JAXRSXmlSecTest extends AbstractBusClientServerTestBase
{
     
     @Test
     public void testPostEncryptedSignedBookInvalid() throws Exception {
-        if (STAX_PORT.equals(test.port)) {
-            // TODO Problem with error handling on the server side
-            return;
-        }
         String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put("ws-security.callback-handler", 


Mime
View raw message