Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C6FB0200BCB for ; Thu, 24 Nov 2016 12:07:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C58BE160B1F; Thu, 24 Nov 2016 11:07:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 17D21160B11 for ; Thu, 24 Nov 2016 12:07:56 +0100 (CET) Received: (qmail 12772 invoked by uid 500); 24 Nov 2016 11:07:56 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 12759 invoked by uid 99); 24 Nov 2016 11:07:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2016 11:07:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3143EDFCC7; Thu, 24 Nov 2016 11:07:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Date: Thu, 24 Nov 2016 11:07:56 -0000 Message-Id: <814d2052f2a74c3388014fa6ecd42e86@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] cxf git commit: [CXF-7119] Adding a test resource archived-at: Thu, 24 Nov 2016 11:07:58 -0000 Repository: cxf Updated Branches: refs/heads/3.1.x-fixes b9431024b -> c3c887a19 [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/c3c887a1 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c3c887a1 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c3c887a1 Branch: refs/heads/3.1.x-fixes Commit: c3c887a19fde10d387b36e04fde4669684ba023e Parents: 96f6479 Author: Sergey Beryozkin Authored: Thu Nov 24 11:03:26 2016 +0000 Committer: Sergey Beryozkin Committed: Thu Nov 24 11:07:27 2016 +0000 ---------------------------------------------------------------------- .../systest/jaxrs/CustomFaultInInterceptor.java | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c3c887a1/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 { + 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"); + } + +}