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 8EC1FFEE8 for ; Wed, 5 Nov 2014 10:38:43 +0000 (UTC) Received: (qmail 29825 invoked by uid 500); 5 Nov 2014 10:38:43 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 29780 invoked by uid 500); 5 Nov 2014 10:38:43 -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 29767 invoked by uid 99); 5 Nov 2014 10:38:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Nov 2014 10:38:42 +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 (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.213.169 as permitted sender) Received: from [209.85.213.169] (HELO mail-ig0-f169.google.com) (209.85.213.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Nov 2014 10:38:38 +0000 Received: by mail-ig0-f169.google.com with SMTP id hn18so8056303igb.4 for ; Wed, 05 Nov 2014 02:37:32 -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:content-transfer-encoding; bh=X2eEnTbHAvnUPQMxv5cWslu9cGVKeL9n7pzKMRgaJ1k=; b=B2aI/s3LPilU9z4jrzbq9rWjMHMz06wnlWkhSs0y69CuLt6NVH+Jdq5MDRzAzb6aaS eYswkPqoCiDsXLyD11/VpsYy5kKTLPsfbVg6fzN2/o8WKr1VSAgOuK0D3gAbzZD3AtsD fErdwVj01tuAoX9MUCNYROdd34Y3lh6F3y+gengrmPpePaYy5FugmCnP2W4cP/xYG6YM 79IDJxiTJV+JlV4T+5qVrv7dp43xhKCy3ptNiU80SNr0Yti8iLoEHuL/u8hLZT4xFsQC QUngBaKC58V2RgJkyX/pIxJX778NbOBosfF7GRWmyhiD5PDLCVuCezpktEAaEfmWjX36 LQlg== X-Received: by 10.107.28.131 with SMTP id c125mr35420950ioc.29.1415183852681; Wed, 05 Nov 2014 02:37:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.126.136 with HTTP; Wed, 5 Nov 2014 02:37:12 -0800 (PST) In-Reply-To: <0302CA00-4343-459E-9C81-707563485D85@gmx.at> References: <0302CA00-4343-459E-9C81-707563485D85@gmx.at> From: Claus Ibsen Date: Wed, 5 Nov 2014 11:37:12 +0100 Message-ID: Subject: Re: Rest DSL - how to configure SSL/Basic Auth for jetty component? To: "users@camel.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi You can configure the jetty component regularly without the rest dsl, and just refer to jetty as the component. Then the Rest DSL uses the jetty with the security settings you have configured on it. And I think we have fixed the double ? in the uri in the upcoming 2.14.1 release. On Wed, Nov 5, 2014 at 10:53 AM, Roman Vottner wrote: > This is a repost of the nabble forum entry as my account was obviously no= t correctly verified at the time when I posted this issue (post has NOT bee= n accepted =E2=80=A6). > > In order to test the new REST feature in 2.14.0 I created a simple route = class: > > public class RestTestRoute extends RouteBuilder { > > @Override > public void configure() throws Exception { > > restConfiguration() > .component("jetty") > .port(8383) > .scheme("https") > .contextPath("/api/v1") > .endpointProperty("sslKeystore", "/security/serverKey.jks") > .endpointProperty("sslPassword", "keystorePW") > .endpointProperty("sslKeyPassword", "jettyPW") > // .componentProperty("sslContextParameters", "#sslContextPara= meters") > .componentProperty("handlers", "#jettyAuthHandler"); > > rest("/service4") > .get().route().log("Service4 GET request received").endRest() > .post().route().log("Service4 POST request received").endRest(= ) > .delete().route().log("Service4 DELETE request received").endR= est(); > } > } > > However, special-characters like "/" or ":" get replaced by "%2F" and "%3= A" which cause a UnknownFormatConversionException: Conversion =3D 'F' in th= e primer case and a MissingFormatArgumentException: Format specifier '3A' i= n the latter case. As endpoint- or componentProperty only allows for string= value declarations, I also tried to set Spring beans as used with a leadin= g # before but without any success. > > If I leave out the sslKeystore stuff the example fails with a FileNotFoun= dException as it can't locate the keystore in my home-directory - which I h= ave none. Though, I'd like to use the JKS located in the security-subfolder= of my project. The documentation lacks a full example which showcases a bi= t more complex scenario. > > From debugging, I also figured out that the contextPath is not added on t= op of the "jetty:..." generated URL - is this only valid in servlet scenari= os? Moreover, I'm a bit confused about the generated URL in JettyHttpCompon= ent as it contains two '?' symbols: > > jetty:%s://%s:%s/%s?httpMethodRestrict=3D%s?sslPassword=3DkeystorePW&sslK= eyPassword=3DjettyPW&sslKeystore=3D%2Fsecurity%2FserverKey.jks > > A simple test-project setup can be gathered in rest-dsl branch on github:= https://github.com/RovoMe/CamelMultipleJettyComponents/tree/rest-dsl > > Kind regards, > > Roman --=20 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/