Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A84A810D96 for ; Wed, 21 Jan 2015 12:54:20 +0000 (UTC) Received: (qmail 3529 invoked by uid 500); 21 Jan 2015 12:54:20 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 3484 invoked by uid 500); 21 Jan 2015 12:54:20 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 3468 invoked by uid 99); 21 Jan 2015 12:54:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2015 12:54:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.223.175 as permitted sender) Received: from [209.85.223.175] (HELO mail-ie0-f175.google.com) (209.85.223.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2015 12:53:55 +0000 Received: by mail-ie0-f175.google.com with SMTP id ar1so10444469iec.6 for ; Wed, 21 Jan 2015 04:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vCxvPpgEc2waVCaXIMwK9mykFYO1Zfn5bz0/lskduEk=; b=CEQfNoOzTvczSg984ZP9kXZJczAYBHUdcuVWYpl2H4ZSjRiidJP+1JK9ObSl5d7hNZ E2XKrGOsmIEgeCb/5h0IJQ/TIeqr2YZ9ILAsZ7GdRuMg0My+sBo8lxFqVGc0lSUcMOQ4 vzD5ysyi5QQ5/e+EeSqRMW7DGxZe1/3qDlqVE2RBgkbOswfoM0AHzKo01JdoBVr7edcR Gqn8ihXIYn+x1V67oMZtXA+d37jwM9aDPYFLtguWs8keJ2UO7/AzuwFkuLSYvx+MQAIp +dnSNrnY/jLgwrUQp6Ge/p+/0ML9OGzjoHQNoGn02g4WjfihEcHSxdfME7WYVLKl0420 XgkQ== X-Received: by 10.50.66.171 with SMTP id g11mr3850946igt.49.1421844833891; Wed, 21 Jan 2015 04:53:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.232.232 with HTTP; Wed, 21 Jan 2015 04:53:33 -0800 (PST) In-Reply-To: References: From: Claus Ibsen Date: Wed, 21 Jan 2015 13:53:33 +0100 Message-ID: Subject: Re: Rest DSL Exception mapping To: "users@camel.apache.org" Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org You can use the option skipBindingOnErrorCode to control if the binding should happen or not. On Wed, Jan 21, 2015 at 1:24 PM, James Green wrote: > Just re-reading the "Binding POJOs" bit, will this also take effect for the > out part of an exception? > > onException(MyException.class).handled(true).setHeader(Exchange.HTTP_RESPONSE_CODE, > constant(400)).process(myExceptionHandler).end() > > Should I expect the Message provided by myExceptionHandler to be formatted > to JSON/XML according to the HTTP client's choice? > > > On 21 January 2015 at 11:51, James Green wrote: > >> If Camel can accept and map both JSON and XML inputs to POJOs, is there a >> way of reversing this for onException handling purposes? >> >> The only example of onException sets the content-type and formatted >> content on the Exchange. But I may not know this. >> >> Within Spring MVC there is @ResponseStatus allowing us to specify the HTTP >> response code for a particular Exception without needing to care about the >> response content type, which is the bit I'm not spotting an equivalent for. >> >> Am I missing something or is this a bit of a hole? >> >> Thanks, >> >> James >> >> -- Claus Ibsen ----------------- Red Hat, Inc. Email: cibsen@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/