cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1438080 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
Date Thu, 24 Jan 2013 17:18:36 GMT
Author: dkulp
Date: Thu Jan 24 17:18:35 2013
New Revision: 1438080

URL: http://svn.apache.org/viewvc?rev=1438080&view=rev
Log:
[CXF-4756] Ability to specify action to use for unchecked exceptions via an annotation

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java
Modified:
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java

Added: cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java?rev=1438080&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/FaultAction.java Thu Jan 24 17:18:35
2013
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.addressing;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * If applied on an exception type, the value specifies the WS-Addressing Action
+ * which will be applied if this exception is thrown from a WSA-enabled service.
+ * This setting overrides any other settings, for example from @javax.xml.ws.Action.
+ * If the value is null, this annotation is ignored.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@Target(ElementType.TYPE)
+public @interface FaultAction {
+    String value();
+}

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java?rev=1438080&r1=1438079&r2=1438080&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
(original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/InternalContextUtils.java
Thu Jan 24 17:18:35 2013
@@ -64,6 +64,7 @@ import org.apache.cxf.ws.addressing.Addr
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.FaultAction;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.ws.addressing.Names;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
@@ -370,12 +371,16 @@ final class InternalContextUtils {
             // wsa relevant faults should use the wsa-fault action value
             action = Names.WSA_DEFAULT_FAULT_ACTION;
         } else {
-            action = getActionFromServiceModel(message, fault);    
+            FaultAction annotation = null;
+            if (fault != null) {
+                annotation = fault.getClass().getAnnotation(FaultAction.class);
+            }
+            if ((annotation != null) && (annotation.value() != null)) {
+                action = annotation.value();
+            } else {
+                action = getActionFromServiceModel(message, fault);
+            }
         }
-        // REVISIT: add support for @{Fault}Action annotation (generated
-        // from the wsaw:Action WSDL element). For the moment we just
-        // pick up the wsaw:Action attribute by walking the WSDL model
-        // directly 
         LOG.fine("action: " + action);
         return action != null ? ContextUtils.getAttributedURI(action) : null;
     }



Mime
View raw message