cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [2/2] cxf git commit: [CXF-7119] Adding a test resource
Date Thu, 24 Nov 2016 11:08:54 GMT
[CXF-7119] Adding a test resource


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

Branch: refs/heads/3.0.x-fixes
Commit: a6e0532e4112f2b5ffc8c11b97e000ef11da41c7
Parents: 8e4970d
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Nov 24 11:03:26 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Nov 24 11:08:37 2016 +0000

----------------------------------------------------------------------
 .../systest/jaxrs/CustomFaultInInterceptor.java | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a6e0532e/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomFaultInInterceptor.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomFaultInInterceptor.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomFaultInInterceptor.java
new file mode 100644
index 0000000..bd29c08
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/CustomFaultInInterceptor.java
@@ -0,0 +1,41 @@
+/**
+ * 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.systest.jaxrs;
+
+import javax.ws.rs.ProcessingException;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class CustomFaultInInterceptor extends AbstractPhaseInterceptor<Message> {
+    public CustomFaultInInterceptor() {
+        super(Phase.PRE_STREAM);
+    } 
+
+    public void handleMessage(Message message) throws Fault {
+        Exception ex = message.getContent(Exception.class);
+        throw new ProcessingException(ex.getCause().getClass().getSimpleName() 
+            + ": Microservice at "
+            + message.get(Message.REQUEST_URI)
+            + " is not available");
+    }
+      
+}


Mime
View raw message