cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1149435 - in /cxf/branches/2.4.x-fixes: ./ api/src/main/java/org/apache/cxf/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/
Date Fri, 22 Jul 2011 02:24:12 GMT
Author: dkulp
Date: Fri Jul 22 02:24:11 2011
New Revision: 1149435

URL: http://svn.apache.org/viewvc?rev=1149435&view=rev
Log:
Merged revisions 1149433 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1149433 | dkulp | 2011-07-21 22:00:25 -0400 (Thu, 21 Jul 2011) | 3 lines
  
  [CXF-3672] Make it easier to control the status code sent back for
  Faults
  patch from qiu zhan bo used as starting point
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
    cxf/branches/2.4.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java?rev=1149435&r1=1149434&r2=1149435&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java (original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/interceptor/Fault.java Fri Jul
22 02:24:11 2011
@@ -38,9 +38,15 @@ public class Fault extends UncheckedExce
     public static final QName FAULT_CODE_SERVER = new QName("http://cxf.apache.org/faultcode",
"server");
     public static final String STACKTRACE_NAMESPACE = "http://cxf.apache.org/fault";
     public static final String STACKTRACE = "stackTrace";
+    private static final int DEFAULT_HTTP_RESPONSE_CODE = 500;
+
     private Element detail;
     private String message;
     private QName code;
+    /**
+     * response http header status code
+     */
+    private int statusCode = DEFAULT_HTTP_RESPONSE_CODE;
     
     public Fault(Message message, Throwable throwable) {
         super(message, throwable);
@@ -161,4 +167,21 @@ public class Fault extends UncheckedExce
         }
         return detail;
     }
+    
+    /**
+     * Returns  http header status code.
+     * @return status code.
+     */
+    public int getStatusCode() {
+        return this.statusCode;
+    }
+    
+    /**
+     * Set http header status code on this fault.
+     * 
+     * @param status code.
+     */
+    public void setStatusCode(int statusCode) {
+        this.statusCode = statusCode;
+    }
 }

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java?rev=1149435&r1=1149434&r2=1149435&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
Fri Jul 22 02:24:11 2011
@@ -42,7 +42,8 @@ public class Soap11FaultOutInterceptor e
         super(Phase.PREPARE_SEND);
     }
     public void handleMessage(SoapMessage message) throws Fault {
-        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+        Fault f = (Fault) message.getContent(Exception.class);
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, f.getStatusCode());
         message.getInterceptorChain().add(Soap11FaultOutInterceptorInternal.INSTANCE);
     }
     

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?rev=1149435&r1=1149434&r2=1149435&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Fri Jul 22 02:24:11 2011
@@ -44,7 +44,8 @@ public class Soap12FaultOutInterceptor e
         super(Phase.PREPARE_SEND);
     }
     public void handleMessage(SoapMessage message) throws Fault {
-        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+        Fault f = (Fault) message.getContent(Exception.class);
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, f.getStatusCode());
         if (message.getVersion().getVersion() == 1.1) {
             message.getInterceptorChain().add(Soap11FaultOutInterceptorInternal.INSTANCE);
         } else {
@@ -60,10 +61,10 @@ public class Soap12FaultOutInterceptor e
         }
         public void handleMessage(SoapMessage message) throws Fault {
             LOG.info(getClass() + (String) message.get(SoapMessage.CONTENT_TYPE));
-            message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
             
             XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
             Fault f = (Fault)message.getContent(Exception.class);
+            message.put(org.apache.cxf.message.Message.RESPONSE_CODE, f.getStatusCode());
     
             SoapFault fault = SoapFault.createFault(f, message.getVersion());       
 

Modified: cxf/branches/2.4.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java?rev=1149435&r1=1149434&r2=1149435&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
Fri Jul 22 02:24:11 2011
@@ -53,12 +53,12 @@ public class XMLFaultOutInterceptor exte
             throw (Fault) message.getContent(Exception.class);
         }
         
-        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+        Fault f = (Fault) message.getContent(Exception.class);
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, f.getStatusCode());
         NSStack nsStack = new NSStack();
         nsStack.push();
 
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
-        Fault f = (Fault) message.getContent(Exception.class);
         XMLFault xmlFault = XMLFault.createFault(f);
         try {
             nsStack.add(XMLConstants.NS_XML_FORMAT);



Mime
View raw message