cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1426463 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Date Fri, 28 Dec 2012 11:34:36 GMT
Author: sergeyb
Date: Fri Dec 28 11:34:35 2012
New Revision: 1426463

URL: http://svn.apache.org/viewvc?rev=1426463&view=rev
Log:
Optionally skipping WAE mapper

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1426463&r1=1426462&r2=1426463&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Fri
Dec 28 11:34:35 2012
@@ -151,7 +151,7 @@ public final class JAXRSUtils {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXRSUtils.class);
     private static final String PROPAGATE_EXCEPTION = "org.apache.cxf.propagate.exception";
     private static final String REPORT_FAULT_MESSAGE_PROPERTY = "org.apache.cxf.jaxrs.report-fault-message";
-    
+    private static final String  SUPPORT_WAE_SPEC_OPTIMIZATION = "support.wae.spec.optimization";
     private static final Map<Integer, Class<?>> EXCEPTIONS_MAP;
     static {
         EXCEPTIONS_MAP = new HashMap<Integer, Class<?>>();
@@ -1397,6 +1397,16 @@ public final class JAXRSUtils {
     }
     
     public static <T extends Throwable> Response convertFaultToResponse(T ex, Message
inMessage) {
+        
+        if (ex.getClass() == WebApplicationException.class) {
+            WebApplicationException webEx = (WebApplicationException)ex;
+            if (webEx.getResponse().hasEntity() 
+                && webEx.getCause() == null
+                && MessageUtils.isTrue(inMessage.getContextualProperty(SUPPORT_WAE_SPEC_OPTIMIZATION)))
{
+                return webEx.getResponse();
+            }
+        }
+        
         ExceptionMapper<T>  mapper =
             ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
         if (mapper != null) {



Mime
View raw message